2017-04-21 1 views
2

www가 아닌 ​​도메인에서 www 도메인으로 리디렉션되는 정보가 많이 있다는 것을 알고 있습니다. 하지만 내 문제는 홈 페이지의 리디렉션을 관리 할 수 ​​있지만 서브 페이지는 관리 할 수 ​​없다는 점입니다.htaccess에서 www가 아닌 ​​www에서 www로 모든 페이지를 리디렉션합니다.

내가 리디렉션이 www.ourenglishclass.eu/index.php

에 발생 ourenglishclass.eu/fill-in-text-5th-6th-grade 같은 URL을 입력 할 때 당신은 그래서 예를 here을 볼 수 있었다 나는 이런 식으로 행동하는 원인이 아마 더 재 작성 규칙이 있음을 볼 수 있지만 내가 무엇을 찾을 수없는, 또는 어떻게이

이 리디렉션 규칙이 /index.php 할 수 있습니다 해결할 수

# 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
# 
# If the requested path and file is not /index.php and the request 
# has not already been internally rewritten to the index.php script 
RewriteCond %{REQUEST_URI} !^/index\.php 
# and the requested path and file doesn't directly match a physical file 
RewriteCond %{REQUEST_FILENAME} !-f 
# and the requested path and file doesn't directly match a physical folder 
RewriteCond %{REQUEST_FILENAME} !-d 
# internally rewrite the request to the index.php script 
RewriteRule .* index.php [L] 

나는 이러한 리디렉션 규칙을 비 - WWW에 WWW :

# Redirect to www 
    RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ 
    RewriteCond %{HTTPS}s ^on(s)| 
    RewriteRule^http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

희망 누군가가

답변

1

문제가 될 것으로 보인다 길을 가리킬 수 있습니다 사실로 인해

#RewriteCond %{HTTP_HOST} !^www\. [NC] 
    #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 

와 (내가 https로도 테스트를 해요 때문입니다) 프런트 컨트롤러 규칙 아래에 리디렉션 규칙을 배치하여 모든 것을 index.php으로 전달하므로 REQUEST_URI/index.php과 같습니다.

은 다음과 같이 규칙 유무 :

RewriteEngine On 

# Redirect to www 
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ 
RewriteCond %{HTTPS}s ^on(s)| 
RewriteRule^http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] 

# 
RewriteRule^- [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
# 
# If the requested path and file is not /index.php and the request 
# has not already been internally rewritten to the index.php script 
RewriteCond %{REQUEST_URI} !^/index\.php 
# and the requested path and file doesn't directly match a physical file 
RewriteCond %{REQUEST_FILENAME} !-f 
# and the requested path and file doesn't directly match a physical folder 
RewriteCond %{REQUEST_FILENAME} !-d 
# internally rewrite the request to the index.php script 
RewriteRule^index.php [L] 

이 변경을 테스트하기 전에 당신이 명확한 브라우저 캐시를 확인합니다.

+1

설명과 솔루션을 제공해 주셔서 감사합니다. 그게 효과가있어! –

관련 문제