的.htaccess重写复杂的网址重写、复杂、网址、htaccess

由网友(怠慢)分享简介:我有以下的.htaccess containg一些规则:I have the following .htaccess containg some rules:Options +FollowSymLinks -MultiViewsRewriteEngine OnRewriteBase /RewriteCond %...

我有以下的.htaccess containg一些规则:

I have the following .htaccess containg some rules:

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-9s]+)-([&/A-Za-z0-9s]+)-([&/A-Za-z0-9s]+)-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-9s]+)-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-9s]+)-([&/A-Za-z0-9s]+)-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]

当我点击我的网站链接:

When I click this link on my website:

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

任何帮助,请?

推荐答案

这行:

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]
阅读全文

相关推荐

最新文章