【发布时间】:2016-03-31 22:22:54
【问题描述】:
我的 .htaccess 文件中有以下代码,这意味着将目录转换为查询字符串参数:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^g/XXXXXXXXXX-WINEGIFTS1$ g/index.php?u=XXXXXXXXXX-WINEGIFTS [L,QSA]
RewriteRule ^g/(.*)$ g/index.php?u=$1 [L,QSA]
所以,http://example.com/g/SOMETEXT 应该被重写为 http://example.com/g/index.php?u=SOMETEXT
就目前而言,它工作正常。
但是,如果我取消注释掉注释行,我会收到 500 Internal Server Error。
该行旨在将一个特定的 URL http://example.com/g/XXXXXXXXXX-WINEGIFTS1 重写为 http://example.com/g/index.php?u=XXXXXXXXXX-WINEGIFTS
奇怪的是,我在不同的域、不同的服务器上运行完全相同的代码,并且运行良好。
对导致此错误的原因有什么想法吗?
谢谢!
【问题讨论】:
标签: .htaccess mod-rewrite