2014-02-25 5 views
0

내가 사용자가 article.php하고 페이지를 보여 앞으로htaccess로 규칙은 때때로 항상은 아니지만

www.mydomain.com/en/this-is-an-article.html 

에 규칙을 내 htaccess로

RewriteRule ^(el|en)/(.*).html/?$ article.php?lang=$1&url=$2 [L,NC,QSA] 

에 다음과 같은 규칙을 이동 한 경우 실패합니다.

문제는 때때로 규칙이 실패하고 대신하는

www.mydomain.com/en/this-is-an-article.html 

의 이동

www.mydomain.com/article.php 

로 이동 페이지가 통과 매개 변수를 전송하지 않기 때문에 렌더링하지 실행할 수없는 것이있다 그것을 처리하십시오

페이지를 보려면 다른 클릭을하면 예상대로 페이지가 렌더링됩니다.

처음으로 나는 그런 것을 본다.

전체 htaccess로 코드

RewriteEngine on 

Options -Indexes 
AddDefaultCharset UTF-8 

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* 

<IfModule mod_security.c> 
SecFilterEngine Off 
SecFilterScanPOST Off 
</IfModule> 

<Limit GET POST> 
order deny,allow 
deny from all 
allow from all 
</Limit> 
<Limit PUT DELETE> 
order deny,allow 
deny from all 
</Limit> 

# WEEK 
<FilesMatch "\.(pdf|swf|js|css|jpg|png|gif|JPG)$"> 
    Header set Cache-Control "max-age=604800" 
</FilesMatch> 


<ifModule mod_gzip.c> 
    mod_gzip_on Yes 
    mod_gzip_dechunk Yes 
    mod_gzip_item_include file \.(html?|txt|css|js|php|pl|ttf|woff)$ 
    mod_gzip_item_include handler ^cgi-script$ 
    mod_gzip_item_include mime ^text/.* 
    mod_gzip_item_include mime ^application/x-javascript.* 
    mod_gzip_item_exclude mime ^image/.* 
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* 
</ifModule> 


#fcp.php 
RewriteRule ^(el|en)/fcp.php?$ fcp.php?lang=$1 [L,NC,QSA] 

#tuner.php 
RewriteRule ^(el|en)/index-b/(.*).html/?$ index-b.php?lang=$1&url=$2 [L,NC,QSA] 
RewriteRule ^(el|en)/catalog-b/(.*).html/?$ catalog-b.php?lang=$1&url=$2 [L,NC,QSA] 

#product.php 
RewriteRule ^(el|en)/product/(.*).html/?$ product.php?lang=$1&url=$2 [L,NC,QSA] 

#article.php 
RewriteRule ^(el|en)/(.*).html/?$ article.php?lang=$1&url=$2 [L,NC,QSA] 

#controller.php 
RewriteRule ^(el|en)/(.*)/p/([^.]+)?$ controller.php?lang=$1&url=$2&p=$3 [L,NC,QSA] 
RewriteRule ^(el|en)/(.*)/?$ controller.php?lang=$1&url=$2 [L,NC,QSA] 

#index.php 
RewriteRule ^(el|en)?$ index.php?lang=$1 [L,NC,QSA] 

사람이

+1

이 유일한 규칙입니다 또는 당신은 또한 더 규칙을 가지고? – anubhava

+0

아니지만 .html을 가진 유일한 사람은 다른 규칙과 혼동하지 않도록합니다. – ntan

+0

ok .htaccess 전체를 붙여 넣을 수 있습니까? – anubhava

답변

1

당신의 .htaccess의 상단에이 코드를 배치하려고 도울 수 :

# disable MultiViews as it conflicts with mod_rewrite 
Options +FollowSymLinks -MultiViews 
RewriteEngine on 

# skip further rewrites if rewrite has already happened OR else 
# if request is for a valid file/directory 
RewriteCond %{ENV:REDIRECT_STATUS} 200 [OR] 
RewriteCond %{REQUEST_FILENAME} -d [OR] 
RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -l 
RewriteRule^- [L] 
+0

위의 코드에서 설명하는 내용을 설명해주십시오. – ntan

+0

설명에 대한 설명이 추가되었습니다. – anubhava

+1

고마워. 나는 그것을 시도 할 것이지만 모든 것이 잘 작동하는지 항상 언젠가는 실패 할 것이 확실하다. – ntan

관련 문제