.htaccess Htaccess重定向,重定向循环
我想将.htaccess Htaccess重定向,重定向循环,.htaccess,url,url-redirection,.htaccess,Url,Url Redirection,我想将mysite.com/index.php重定向到mysite.com/index.php?id\u category=12&controller=category 这是我的htaccess文件 但它不起作用。Chrome说:这个网页有一个重定向循环 Options +FollowSymLinks +SymLinksIfOwnerMatch RewriteEngine On RewriteBase / RewriteRule index\.php http://mysite.com/in
mysite.com/index.php
重定向到mysite.com/index.php?id\u category=12&controller=category
这是我的htaccess文件
但它不起作用。Chrome说:这个网页有一个重定向循环
Options +FollowSymLinks +SymLinksIfOwnerMatch
RewriteEngine On
RewriteBase /
RewriteRule index\.php http://mysite.com/index.php?id_category=12&controller=category
可能您应该更改使用另一个文件名,而不是index.php作为destiny。但你可以试试: RewriteRule index.php index.php?id_category=12&controller=category这应该可以:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/index.php$
RewriteCond %{QUERY_STRING} ^$
RewriteRule (.*) http://www.mywebsite.com/index.php?foo=bar [R=301,L]
第一个条件检查URI是否等于
index.php
,第二个条件检查GET值是否为空。这两个条件之间的AND在这里是隐含的。为什么mysite.com/index.php
?您没有在输入的URL中传递参数,因此无需输入index.php
mysite.com
就足够了。你确定这就是你想要的吗?