【发布时间】:2011-09-06 03:54:49
【问题描述】:
我在我的网站上设置了一个简单的 mod_rewrite 系统,它基本上可以转换
http://site.com/file -> http://site.com/file.php
这是 .htaccess 文件
Options -MultiViews
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.site.com
RewriteRule ^(.*)$ http://site.com/$1 [R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]+)/?$ http://site.com/$1.php [L]
这工作了很长时间,然后几天前我意识到,当 RewriteRule 工作时,它实际上正在更改我在状态栏中的 URL。
例如,它会将 /photos 重定向到 /photos.php,但它也会更改 URL 以显示 .php。这种情况以前从未发生过,我不确定是什么触发了这种变化。
有什么想法吗?
【问题讨论】:
标签: apache .htaccess mod-rewrite