2012-12-04 4 views
0

내가 리디렉션하고 싶은 mysite.com/index.php 다음htaccess로 재 지정, 재 지정 루프

내 htaccess로 파일이 mysite.com/index.php?id_category=12&controller=category합니다.

하지만 작동하지 않습니다. Chrome은 다음과 같이 말합니다 : This webpage has a redirect loop.

Options +FollowSymLinks +SymLinksIfOwnerMatch 

RewriteEngine On 
RewriteBase/

RewriteRule index\.php http://mysite.com/index.php?id_category=12&controller=category 
+0

왜 'mysite.com/index.php'입니까? 입력 된 URL에 매개 변수를 전달하지 않으므로'index.php'를 입력 할 필요가 없습니다. mysite.com 만 있으면 충분합니다. ¿ 그게 네가 원하는거야? –

답변

1

이 작동합니다 :

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 값이 비어 있는지 확인합니다. 2 가지 조건 사이의 AND는 여기에 함축되어 있습니다.

+0

고마워요. :) –

0

아마도 운명에 대해 index.php 대신 다른 파일 이름을 사용해야합니다. 하지만 당신은 시도 할 수 있습니다 :

RewriteRule의의의 index.php의 index.php를 id_category = 12 & 컨트롤러 = 카테고리