2011-12-20 3 views
0

누구든지 .htaccess URL 재 작성 규칙을 도울 수 있습니다..htaccess 리디렉션 규칙

나는 다음과 같은 페이지를 리디렉션해야합니다

www.website.com/index.php?a=some-word-some-other-word 
www.website.com/index.php?a=something 
www.website.com/index.php?a=some-other-thing 

페이지

에 www.website.com/index.php과 같은 내용이 그 모든 www.website.com /index.php 또는 www.website.com/

나는 이미 이것을 요구했고 나는 이것을 얻었다 :

RewriteEngine On 
RewriteBase/

#if the query string has an a parameter 
RewriteCond %{QUERY_STRING} (^|&)a= [NC] 
#Redirect and remove query string parameters 
RewriteRule .* http://www.website.com/? [R=301,L] 

이렇게하면 해당 페이지가 홈 페이지 (사이트 루트)로 리디렉션됩니다. 하지만 다음과 같은 URL이있는 페이지가 있습니다.

i.php?a=something-something-something 

위의 .htaccess 코드는 해당 링크에도 영향을 미칩니다.

아무도 index.php?a=을 기반으로하는 페이지의 링크를 리디렉션 할 수 있으며 i.php?a=의 경우이 아닌 코드를 만들 수 있습니까?

답변

1

이 시도하고 작동하는지 말해 :

RewriteEngine On 
RewriteBase/

#if the query string has an a parameter 
RewriteCond %{QUERY_STRING} (^|&)a= [NC] 
#Redirect and remove query string parameters 
RewriteRule ^index\.php$ http://www.website.com/? [R=301,L] 
+0

덕분에, 그것을 작동합니다. –

+0

작동하는 경우 내 대답을 "유효한"것으로 확인하도록 요청할 수 있습니까? –