Home > Backend Development > PHP Tutorial > url 重写不成功,不得不打开主页,其他打开都是404报错

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

WBOY
Release: 2016-06-13 12:05:05
Original
1177 people have browsed it

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


中吧?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template