.htaccess问题,重定向不起作用

时间:2016-03-12 22:27:12

标签: php apache .htaccess redirect

我的http://www.mywebsite.com/tool/url/google.com文件工作正常,但我想对重定向进行更改。

目前,它将网址重定向到url

现在......我想从中移除http://www.mywebsite.com/tool/google.com路径。所以,我想要RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(url)/(.*)$ /tool/script.php?url=$2 [L,QSA]

我的代码:

RewriteRule ^/(.*)$  /tool/script.php?url=$2 [L,QSA]

我试过了:

RewriteRule ^(.*)$  /tool/script.php?url=$2 [L,QSA]

{{1}}

但是所有人都给了我404错误。任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:1)

$ 2不存在,引用第一个(并且仅在您的代码中)匹配应为$ 1。

相关问题