Mod_rewrite重写引擎不工作


mod_rewrite rewrite engine is not working

我有以下链接,我想用modrewrite改变它。我的电脑里有最新的范例。

我有以下链接:http://localhost/site/index.php?site=blog&action=watch&blogID=1&title=my_new_site

要更改为:http://localhost/site/blog/1/my_new_site

或者如果你有解决方案,我可以使用http://localhost/site/blog/my_new_site

我有这样的代码:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?site=$1

RewriteRule ^/blog/(.*)/(.*)/?$ index.php?site=blog&action=watch&blogID=$1&title=$2

编辑:

我更改了规则,但仍然不起作用

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ index.php?site=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ index.php?site=blog&action=watch&blogID=$1&title=$2 [L]

仍然不工作:http://localhost/site/blog/1/my_new_site

我得到以下错误:请求的URL在此服务器上找不到。

/site/:

试试这个。htaccess
ErrorDocument 404 default
RewriteEngine on
RewriteBase /site/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([^/]+)$ index.php?site=$1 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ index.php?site=$1&action=watch&blogID=$2&title=$3 [L,QSA]