【发布时间】:2014-10-18 00:03:36
【问题描述】:
所以我有一个重写 article?id=10 去 article/10 ,我正在尝试做另一个这样的。
我想从site?=website.com 转到site/website.com。好吧,这似乎是一件容易的事。所以我这样做了
RewriteRule ^site/([0-9]+)$ site.php?id=$1
这与article 重写的规则基本相同。现在我去site/10,例如,我得到了
找不到
在此服务器上找不到请求的 URL /site/sdfsd。
如果它与另一个运行良好的重写相同,为什么会发生这种情况?....
选项 -MultiViews DirectoryIndex index.php 重写引擎开启
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^article/([0-9]+)$ article.php?id=$1 [L,QSA,NC]
RewriteRule ^site/([0-9]+)$ site.php?id=$1
# rewrite from /dir/file/ to /dir/file.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f [NC]
RewriteRule ^(.+?)/?$ /$1.php [L]
【问题讨论】:
-
你确定
site?=website.com是正确的吗?
标签: php regex .htaccess mod-rewrite url-rewriting