您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

.htaccess伪静态有关问题

2024/3/21 22:00:19发布15次查看
.htaccess伪静态问题
.htaccess伪静态问题
rewriteengine on
rewritebase /
errordocument 404 /404.html
rewritecond %{request_filename} !-d
rewritecond %{request_filename} !-f
rewriterule ^(.*)$ index.php?domain=$1 [qsa,pt,l]
我一直用这个,这个有个缺点是什么文件都给包含进去了
比如你访问whois.hangye5.com/womai.cn
这样是可以的
但是如果访问whois.hangye5.com/sitemaps/sitemap1.html
也会跑到index.php文件里去
我想这二个文件不要都跑index.php里去,要修改哪些
------解决思路----------------------
#当目录存在时不做重写
rewritecond %{request_filename} !-d
#当文件存在时不做重写
rewritecond %{request_filename} !-f
whois.hangye5.com/sitemaps/sitemap1.html
也会跑到index.php文件里去,显然 sitemaps/sitemap1.html 是不存在的
^(.*)$ 把一切不存在的东西都包括进去了,所以 404 设置不会起作用(index.php 总是存在的)
你需要在那个 .* 上做文章
------解决思路----------------------
rewriterule ^(.*)/sitemaps/sitemap(\d+)\.html$ $1/sitemaps/sitemap.php?domain=$2
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product