>  기사  >  백엔드 개발  >  url 重写不成功,不得不打开主页,其他打开都是404报错

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

WBOY
WBOY원래의
2016-06-13 12:05:051097검색

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看看有没有用。 
------解决方案--------------------
你的重写能生效吗?
应该在


中吧?

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.