我有一个指定的网址:
http://www.simtalltd.com/hebrew/index.php?option=com_content&task=view&id=15&Itemid=29
之后获得所有字符串像这样: ?希伯来语/ 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
什么是正确的代码?
答案 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]