Apache 使用.htaccess重定向/重写包含以下内容的url:
我试图从Apache 使用.htaccess重定向/重写包含以下内容的url:,apache,.htaccess,redirect,url-redirection,http-status-code-301,Apache,.htaccess,Redirect,Url Redirection,Http Status Code 301,我试图从/index.php?option=com\u k2&view=itemlist&task=category&id=44:pinco重定向到google.it 请注意特殊字符: 但它似乎不起作用 这是我尝试过的测试之一。我错在哪里 redirect 301 /?option=com_k2&view=item&id=44:pinco http://www.google.it 不能使用redirect指令重定向查询字符串。您需要使用℅{QUERY_STRING}变量 Rew
/index.php?option=com\u k2&view=itemlist&task=category&id=44:pinco重定向到google.it
请注意特殊字符:
但它似乎不起作用
这是我尝试过的测试之一。我错在哪里
redirect 301 /?option=com_k2&view=item&id=44:pinco http://www.google.it
不能使用redirect
指令重定向查询字符串。您需要使用℅{QUERY_STRING}
变量
RewriteEngine on
RewriteCond ℅{QUERY_STRING} ^option=com_k2&view=itemlist&task=category&id=44:pinco$
RewriteRule ^index\.php$ http://google.it? [L,R]
“我错在哪里?”-在您理解文档中所说的“URL路径”的含义时…@CBroe:您的意思是路径应该是绝对的吗?还是不可能解析整个查询字符串?URL的路径组件是这里唯一要检查的内容-这就是index.php
。如果要基于查询字符串执行任何操作,则需要使用mod_rewrite(RewriteCond检查查询字符串内容,然后使用RewriteRule根据条件重定向到其他位置。)的可能重复