ISAPI_Rewrite版本3获取所有查询字符串参数

时间:2013-11-11 17:14:01

标签: .htaccess mod-rewrite url-rewriting isapi-rewrite

我有一个指定的网址:

http://www.simtalltd.com/hebrew/index.php?option=com_content&task=view&id=15&Itemid=29

我需要在http://www.simtalltd.com/

之后获得所有字符串

像这样: ?希伯来语/ index.php的选项= com_content&安培;任务=视图和ID = 15&安培; ITEMID = 29

我试过这段代码:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.asp?rewrite_url=$1 [QSA,L,NU]

但我得到:希伯来语/ index.php

什么是正确的代码?

1 个答案:

答案 0 :(得分:0)

蛋糕和平!尝试使用:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/(.+))$
RewriteRule .* /index.asp?rewrite_url=%1 [NC,QSA,L,NU]

或者你可以尝试分别匹配请求和查询字符串的主体:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule (.+) /index.asp?rewrite_url=$1\?%1 [NC,QSA,L,NU]