【发布时间】:2014-08-04 19:31:26
【问题描述】:
所以我有这个网址
http://localhost/site/
我还有另一个文件使它看起来像这样
http://localhost/site/info.php?url=website
我把它变成了
http://localhost/site/info/website.com
有
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ info.php?url=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ info.php?url=$1
现在当我转到 http://localhost/site/ 时,我最终得到了
找不到
在此服务器上找不到请求的 URL /info.php。
但我只是想获得索引访问http://localhost/site/ 而不是http://localhost/site/info
【问题讨论】:
-
site/ 匹配正则表达式 ^([a-zA-Z0-9_-]+)/$ ,因此将被重写为 info.php?url=site
标签: php .htaccess url mod-rewrite