2012-07-17 3 views
0

내 .htaccess 파일에서 mod_rewrite를 사용하여 더 깨끗한 URL을 찾고 있습니다. 루트 디렉토리 내에 만들어진 폴더 인 두 개의 디렉토리 (subdir1, subdir2)가 있습니다. 그것들은 하위 도메인이 아닙니다. .htaccess 파일은 루트, subdir1subdir2의 세 디렉토리에 있습니다.mod_rewrite가 때때로 꺼져 있습니까?

Options All -Indexes 
ErrorDocument 404 /404.php 
FileETag MTime Size 

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{REQUEST_URI} !^/(subdir1|subdir2)(/.*)?$ [NC] 
RewriteCond %{REQUEST_URI} ^(.*)?$ [NC] 
RewriteCond %{SCRIPT_FILENAME} !-f 
RewriteRule ^(.*)$ /subdir1/ [R=301,QSA,L] 

RewriteRule ^(.*)(\.html|\.htm)$ index.php [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)/?$ index.php [L] 
</IfModule> 

을 본 사람은 subdir1 디렉토리에 있습니다 : :

다음의 .htaccess 파일을 루트 디렉토리에있는

Options All -Indexes 
ErrorDocument 404 /404.php 
FileETag MTime Size 

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase /subdir1/ 

RewriteRule ^(.*)(\.html|\.htm)$ index.php [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)/?$ index.php [L] 
</IfModule> 

모든 것이 잘 작동한다. www.mydomain.com/subdir1/1234-myaritcle.html 페이지를 탐색하고 해당 내용을 읽을 수 있지만 때때로 클린 URL을 만들지 않고 다시 쓰기 모듈이 꺼지고 기사가 다음 URL로 열립니다. www.mydomain.com/index.php?article=1234

도와 주실 수 있습니까? 문제의 원인은 무엇입니까? .htaccess 파일에 문제가 있습니까?

답변

0

귀하의 규칙에 따르면 URL이 www.mydomain.com/index.php?article=1234으로 나타나지 않습니다. 기사를 여는 링크가 깨끗한 URL을 생성하지 못하는 것일 수 있습니다.

+0

음, 괜찮아요, 서버의 일부 설정으로 인해 함수가 깨끗한 URL을 만들 수 없습니까? , 그것은 대부분의 시간을 잘 작동하지만 때로는 웹 사이트가 천천히 다음 www.mydomain.com/index.php?article=1234 로 열어 링크가 열립니다 그리고 내가 한 번만 더 질문을하시기 바랍니다 복용량이 효과는 구글이 방법입니다 깨끗한 - URL을 다루는? 내가 Google에 un-clean-urls을 보관하는 것을 원하지 않기 때문입니다. – aadiahg

관련 문제