欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-05-27 14:07:10
...
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看看有没有用。
------解决方案--------------------
你的重写能生效吗?
应该在


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

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频