Heim  >  Artikel  >  Backend-Entwicklung  >  url 重写不成功,不得不打开主页,其他打开都是404报错

url 重写不成功,不得不打开主页,其他打开都是404报错

WBOY
WBOYOriginal
2016-06-13 12:05:051093Durchsuche

url 重写不成功,只能打开主页,其他打开都是404报错
url 重写不成功,只能打开主页,其他打开都是404报错..
用的是godaddy的豪华型linux主机。客服说是支持url重写的,网站用的douphp1.1,后台已经开启了url重写,上传了douphp提供的.htaccess到主机根目录。只能打开主页,产品链接都打不开直接404报错。。。附上.htaccess代码,麻烦各位大师指点。有人说把#RewriteBase /前面的#去掉。我试了,不行,有人说要去http.conf配置一下,但是ftp里面根本就没这个文件夹呢。




    order deny,allow
    deny from all


RewriteEngine On

#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)

# main
RewriteRule ^index\.html$    index\.php [L]
RewriteRule ^sitemap\.xml$    sitemap\.php [L]
RewriteRule ^(404|301)\.html$    $1\.html [L]

# news
RewriteRule ^news(/o)*([0-9]*)$       article_category\.php\?page=$2   [QSA,L]
RewriteRule ^news(/*)([a-z0-9-]*)(/*o*)([0-9]*)$       article_category\.php\?unique_id=$2&page=$4   [QSA,L]

RewriteRule ^news/([0-9]+)\.html$       article\.php\?id=$1&rewrite=1   [QSA,L]
RewriteRule ^news/([a-z0-9-]+)/([0-9]+)\.html$       article\.php\?id=$2&unique_id=$1   [QSA,L]

# product
RewriteRule ^product(/o)*([0-9]*)$       product_category\.php\?page=$2   [QSA,L]
RewriteRule ^product(/*)([a-z0-9-]*)(/*o*)([0-9]*)$       product_category\.php\?unique_id=$2&page=$4   [QSA,L]

RewriteRule ^product/([0-9]+)\.html$       product\.php\?id=$1&rewrite=1   [QSA,L]
RewriteRule ^product/([a-z0-9-]+)/([0-9]+)\.html$       product\.php\?id=$2&unique_id=$1   [QSA,L]

# onepage
RewriteRule ^([a-z0-9-]+)\.html$       page\.php\?unique_id=$1   [QSA,L]
RewriteRule ^guestbook(/)*([a-z]*)(/*o*)([0-9]*)$       guestbook\.php\?rec=$2&page=$4   [QSA,L]
------解决方案--------------------
你就测试一个最简单的。 
RewriteEngine On

RewriteRule ^1.html$  1.php

建立一个1.php文件
访问1.html看看有没有用。 
------解决方案--------------------
你的重写能生效吗?
应该在


中吧?

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn