2013-10-28 7 views
1

URL을 다시 쓰고 싶습니다. 기존 링크가 더 이상 이전 페이지 (주소)로 이동하는 것을 원하지 않습니다.URL 재 지정 및 재 작성 htaccess

Options +FollowSymlinks 
RewriteEngine on 
RewriteRule ^about-us$ /shop/static_page\.php\?static_page_id=3 [NC,L] 

이 내 htaccess로 파일이 순간의 모습, 그리고 그것을 잘 작동합니다 - 나는 등 정상적인 리디렉션 규칙에 추가 할 때 있지만 :

Redirect 301 /shop/static_page.php?static_page_id=3 http://example.com/about-us 

이 작동하지 않습니다 - 마치이 줄이 존재하지 않는 것 같습니다. 어떤 아이디어라도 제발?

답변

1

2 일 : 규칙의

  1. 주문이 너무
  2. mod_rewrite

당신을 위해 작동해야 코드를 다음과 같이 mod_alias 규칙을 혼합하지 마십시오 내부 재 작성하기 전에 301 중요한이된다

Options +FollowSymlinks 
RewriteEngine on 

# external redirect from actual URL to pretty one 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+shop/static_page\.php\?static_page_id=3[\s&] [NC] 
RewriteRule^/about-us? [R=301,L] 

# internal forward from pretty URL to actual one 
RewriteRule ^about-us/?$ /shop/static_page\.php?static_page_id=3 [NC,L,QSA] 
+0

힌트를 보내 주셔서 감사합니다. 그것은 어떻게 보일 것인가? 많은 감사합니다 :) – Tim

+0

@ 팀 : 그냥 예제 코드로 편집했습니다. – anubhava

+0

아름다운. 고마워요 * very * much @anubhava – Tim