【发布时间】:2014-02-17 18:36:02
【问题描述】:
在我在 Windows 上运行 xampp 的开发服务器上,我的 .htacess 重写规则运行良好。一旦我们进入运行Linux core 3.8.0-21-generic #32-Ubuntu SMP Server version: Apache/2.2.22 (Ubuntu) 的实时服务器,我们的不包含参数的规则就不再起作用,但有参数的规则仍然起作用。
Options -Indexes
<filesMatch "\.(html|htm|txt|js|htaccess)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</filesMatch>
ErrorDocument 404 /404.php
RewriteEngine On
#Main site rules
RewriteRule ^login/?$ login.php [NC,L]
RewriteRule ^contact/?$ contact.php [NC,L]
上面的contact.php和login.php规则不起作用。但是,这个带有参数的更复杂的规则正在起作用:
RewriteRule ^game/([a-zA-Z0-9]+)/?$ handles/handle-game-select.php?name=$1 [NC,L]
导致这种情况发生的两个服务器环境之间是否存在差异?
此外,如果我们做一些奇怪的事情,例如:RewriteRule ^contact.x contact.php [NC,L],我们似乎可以访问contact.php...
对此非常困惑。
感谢您的帮助。
【问题讨论】: