2017-02-13 1 views
2

의 .htaccess에서 두 개의 서로 다른 리디렉션이 같은.htaccess; 리디렉션이 너무 많습니다 경우 내가 두 종류의 URL했습니다

http://www.example.com/?content=contact_form.php 

http://www.example.com/?content=product.php&id=20 

내가 변경 내 전체 URL 시스템 :

http://www.example.com/file/contact_form 

http://www.example.com/product/I-m-the-title/20 

물론 Google과 공동으로 .htaccess으로 301 리디렉션했습니다. 새로운 URL

나는 이런 식으로했다 :

# Rewrite URLs 

RewriteEngine On 
RewriteRule ^(ignore)($|/) - [L] 
RewriteRule ^file/([^/]*)$ /?content=$1.php [L] 
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /?content=$1.php&title=$2&id=$3 [L] 


# Redirect old URL to new URL 

RewriteCond %{QUERY_STRING} ^content=contact\_form\.php$ 
RewriteCond %{REQUEST_URI} ^\/$ 
RewriteRule .* http://www.example.com/file/contact_form? [R=301,L] 

RewriteCond %{QUERY_STRING} ^content=product\.php&class=I-m-the-title$ 
RewriteCond %{REQUEST_URI} ^\/$ 
RewriteRule .* http://www.example.com/I-m-the-title/Test/20? [R=301,L] 

내 문제 : 그것은 완벽을 위해 일하고

: http://www.example.com/?content=product.php&id=20

그러나 http://www.example.com/?content=contact_form.php 위해 나는 열 얻을 수없는 메시지를 받고 있어요 리디렉션이 너무 많아서

내가 뭘 잘못하고 있는지 아는 사람이 있습니까? 나는 누군가가 곧 구글을 오해하기 전에 그것을 고쳐야하기 때문에 나를 도울 수 있기를 바랍니다.

답변

1

규칙은 다시 쓰기 루프를 해결하려면 ... 내부 및 외부 리디렉션을 무시 다시 다시 같은 위치에 URI를 다시 작성하고 있기 때문에 무한 루프의 원인이, 당신의 htaccess로의 상단에 다음을 추가

RewriteEngine on 

RewriteCond %{ENV:REDIRECT_STATUS} 200 
RewriteRule^- [L] 
+0

당신은 훌륭합니다. 고마워요, 많이 고마워요! – David

관련 문제