【发布时间】:2018-01-29 03:01:37
【问题描述】:
我的网站中有以下 htaccess 文件,它在过去两年中运行良好。最近我将服务器迁移到一个新的托管合作伙伴,似乎它没有按预期工作。我已经确认服务器支持 mod_rewrite 模块。我可以看到 [QUERY_STRING] => 是 null 我指定的任何 URL,并且所有 URL 都路由到主页。谁能告诉我需要修改什么。我在stackoverflow中看到了很多答案,但对我没有任何帮助。我只是这个 htaccess 文件的初学者。
Options +FollowSymLinks
RewriteEngine On
Options -Indexes
# REWRITING index.php AS index #
RewriteRule ^index/?$ index.php [NC]
# Route The Pages #
RewriteRule ^index/([{a-z}]+)/?$ index.php?$1 [NC,L]
RewriteRule ^index/home/([0-9]+)/?$ index.php?home&p_id=$1 [NC,L]
RewriteRule ^index/page/([{a-z}{\-\}{0-9}]+)/?$ index.php?page&show=$1 [NC,L]
RewriteRule ^index/gallery/([{image}{video}]+)/?$ index.php?gallery&type=$1 [NC,L]
RewriteRule ^index/gallery/([{image}{video}]+)/([0-9]+)/?$ index.php?gallery&type=$1&album=$2 [NC,L]
【问题讨论】:
-
为什么你的模式中有花括号?您能告诉我一些无效的网址吗?
-
其中一个网址是 tgmvidyaniketan.edu.in/index/gallery/image
标签: php .htaccess mod-rewrite