2013-05-03 3 views
0

나는 SEO Friendly URL이 켜져있는 Opencart를 사용하고 있습니다. htaccess로 파일이RewriteCond - 내가 뭘 잘못하고 있니?

RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] 
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css) 
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] 

처럼 보이게했다 그러나 것

나는 대답에서 웹 둘러보고 다시 작성되지 않습니다 폴더 제외하고, 특별히/이메일 전송 시스템

에 추가 할 필요가 I 다음을 수행 :

RewriteCond %{REQUEST_URI} !^/(emailer|js|css)/ [NC] 
RewriteRule^- [L] 
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] 
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css) 
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] 

이렇게하면/emailer/work가되지만 다른 재 작성은 수행하지 않습니다. 아무도 내가 여기서 뭘 잘못하고 있는지 알아?

답변

0

메인 앞에 삽입하십시오 RewriteRule.

RewriteBase/

RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] 
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !^\/(emailer|js|css) [NC] 
RewriteCond %{REQUEST_URI} !\.(ico|gif|jpg|jpeg|png|js|css)$ [NC] 
RewriteRule ^([^?]*) index.php?_route_=$1&request_uri=%{REQUEST_URI} [L,QSA] 

참고 :는 테스트하지,하지만이 그것을 수행하는 방법 아이디어를 당신에게 제공해야합니다.

나중에 편집 :

내 코드를 테스트 한 작동하지 않았다. 나는 그것을 편집하고 그것을 다음과 같이 지금 작동합니다

  1. RewriteCond %{REQUEST_FILENAME} !-f => 요청이 실제 파일 이름이 아닌 경우
  2. RewriteCond %{REQUEST_FILENAME} !-d => 요청이 실제 디렉토리가 아닌 경우
  3. RewriteCond %{REQUEST_URI} !^\/(emailer|js|css) [NC] => 경우 루트 디렉토리에 emailer/js/css로 시작하는 디렉토리/파일이 없습니다
  4. RewriteCond %{REQUEST_URI} !\.(ico|gif|jpg|jpeg|png|js|css)$ [NC] => 요청이 다음 확장자로 끝나지 않는 경우 ico/gif/jpg/jpeg/png/js/CSS

주 :

  • 당신이 당신의 재 작성 규칙에서 슬래시 여부를 필요로하는 경우, 테스트 난 내 변형 예에서와 같이 쿼리 변수를 추가하고 PHP 후 첫 번째 줄에 (그것을 인쇄하기 오픈 태그)를 다음과 같이 index.php 파일에 삽입하십시오 :

    print_r ($ _ GET [ 'request_uri']); exit;

테스트가 끝나면 htacces 및 index.php에서 request_uri를 제거하십시오.

  • 항상
+0

불행히도 작동하지 않았다 /이 \처럼 백 슬래시 슬래시 탈출. 그것은 여전히 ​​재 작성/이메일 발송자입니다. 나는 그것을 ico/gif 앞뒤에 넣으려고 시도했다. 그런 다음 RewriteCond % {REQUEST_URI}! ^/emailer/[NC]로 취소하려고 시도했다. 아직도 운이 없다. – jimbeeer

+0

나는 많은 다른 조합을 시도하고있다. 사이트를 크래시하거나 다시 작성합니다. 여기까지 내가 무엇을 가지고 : RewriteBase/ RewriteRule^sitemap.URL = feed/google_sitemap [L] RewriteRule^googlebase.xml $ index.php? route = feed/google_base [L] RewriteCond % {REQUEST_FILENAME}! -f RewriteCond % {REQUEST_FILENAME}! - xml $ index.php? d RewriteCond % {REQUEST_URI}! \. (ico | gif | jpg | jpeg | png | js | css) $ [NC] RewriteCond % {REQUEST_URI}! ^/emailer /? $ RewriteRule^*) index.php? _route _ = $ 1 [L, QSA] – jimbeeer