2014-12-22 4 views
0

I이 몇 가지 규칙 containg 다음의 .htaccess :htaccess로 재 작성 복잡한 URL

Options +FollowSymLinks -MultiViews 
RewriteEngine On 

RewriteBase/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.*?)(?:\+|%20|\s)+(.+?)\sHTTP [NC] 
RewriteRule^/%1-%2 [L,NE,R=302] 
RewriteRule ^([_&/A-Za-z0-9\s]+)-([&/A-Za-z0-9\s]+)-([&/A-Za-z0-9\s]+)-Photographers?$ html/photographers-10.cfm?county=$1&speciality=$2&address4=$3&rwtn [NC,L] 
RewriteCond %{QUERY_STRING} !rwtn 
RewriteCond %{QUERY_STRING} ^county=(.*)&speciality=(.*)&address4=(.*) 
RewriteRule ^html/photographers-10\.cfm$ http://www.photographers.co.uk/%3-%2-Photographers? [R=301,L] 




RewriteRule ^([_&/A-Za-z0-9\s]+)-Photographers/?$ html/photographers-4.cfm?county=$1&rwtn [NC,L] 
RewriteCond %{QUERY_STRING} !rwtn 
RewriteCond %{QUERY_STRING} ^county=(.*) 
RewriteRule ^html/photographers-4\.cfm$ http://www.photographers.co.uk/%1-Photographers? [R=301,L] 



RewriteRule ^([_&/A-Za-z0-9]+)-([&/A-Za-z0-9]+)-Photographers?$ html/photographers-5.cfm?county=$1&speciality=$2&rwtn [NC,L] 
RewriteCond %{QUERY_STRING} !rwtn 
RewriteCond %{QUERY_STRING} ^county=(.*)&speciality=(.*) 
RewriteRule ^html/photographers-5\.cfm$ http://www.photographers.co.uk/%1-%2-Photographers? [R=301,L] 



RewriteRule ^Canary-Wharf-London-Photographer/?$ html/photographers-9.cfm?address4=Canary-Wharf&county=London&rwtn [NC,L] 
RewriteRule ^City-of%2520London-London-Photographer/?$ html/photographers-9.cfm?address4=City-of%20London&county=London&rwtn [NC,L] 
RewriteRule ^East-London-London-Photographer/?$ html/photographers-9.cfm?address4=East-London&county=London&rwtn [NC,L] 
RewriteRule ^Kingston-upon%2520Thames-London-Photographer/?$ html/photographers-9.cfm?address4=Kingston-upon Thames&county=London&rwtn [NC,L] 
RewriteRule ^NOTTING-HILL-London-Photographer/?$ html/photographers-9.cfm?address4=NOTTING-HILL&county=London&rwtn [NC,L] 
RewriteRule ^South-Woodford-London-Photographer/?$ html/photographers-9.cfm?address4=South-Woodford&county=London&rwtn [NC,L] 
RewriteRule ^Stamford-Brook-London-Photographer/?$ html/photographers-9.cfm?address4=Stamford-Brook&county=London&rwtn [NC,L] 

RewriteRule ^([_&/A-Za-z0-9\s]+)-([&/A-Za-z0-9\s]+)-Photographer/?$ html/photographers-9.cfm?address4=$1&county=$2&rwtn [NC,L] 
RewriteCond %{QUERY_STRING} !rwtn 
RewriteCond %{QUERY_STRING} ^address4=(.*)&county=(.*) 
RewriteRule ^html/photographers-9\.cfm$ http://www.photographers.co.uk/%1-%2-Photographer/? [R=301,L] 

나는 내 웹 사이트에이 링크를 클릭

http://www.photographers.co.uk/html/photographers-10.cfm?county=Nottinghamshire&speciality=Portrait&address4=Nottingham

그것은 에 저를 리디렉션해야을 :

http://www.photographers.co.uk/Nottingham-Portrait-Photographers

그러나 실제로 나에 리디렉션됩니다 :

http://www.photographers.co.uk/Nottinghamshire-Portrait-Nottingham-Photographers

어떤 도움을 주 시겠어요?

+1

http : //www.photographers.co.uk/%1-%2-%3-Photographers?'에'= (. *) & specialty = (. *) & address4 = (. *) 1 '은 전문은'% 2'이고 주소 4는'% 3'입니다. 원하는 경우 해당 행을 'http : //www.photographers.co.uk/%3%2-Photographers?'로 간단히 변경할 수 있습니다. 이 주소와 같은 주소는 모두 해당 형식으로 변환됩니다. – craniumonempty

답변

0

이 줄 :

RewriteRule ^html/photographers-10\.cfm$ http://www.photographers.co.uk/%1-%2-%3-Photographers? [R=301,L] 

은 다음과 같아야합니다

RewriteRule ^html/photographers-10\.cfm$ http://www.photographers.co.uk/%3-%2-Photographers? [R=301,L] 
이 '% {QUERY_STRING}^군을 재 작성 어디에 그것 (끝) 최초 다시 쓰기 규칙 세트에 말했다 무엇을하고있어
+0

고맙습니다. 그것은 효과가 있었다. 당신은 또한보십시오 : http://stackoverflow.com/questions/27453951/how-to-redirect-pattern-url-to-a-specific-page-but-keep-the-same-url? –