【发布时间】:2011-02-24 04:22:26
【问题描述】:
可以在用户可以输入的地方使用 mod_rewrite 和 htaccess 重写我的 url:
http://www.mainsite.com/12345
服务器将翻译为:
http://www.mainsite.com/index.php?ID=12345
通过尝试从所有页面中删除文件扩展名,(删除 .php)它会发生冲突并导致永无止境的重定向:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.php$ $1 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9a-zA-Z]+)$ index.html?ID=$1 [QSA,NC,L,R]
</IfModule>
【问题讨论】:
标签: .htaccess