papachumba Newbie

Joined: 27 January 2006 Location: United Kingdom
Online Status: Offline Posts: 18
|
| Posted: 23 June 2008 at 8:38am | IP Logged
|
|
|
Hiya, ok 2 sites amongst several other sites on the server (mysite1, mysite2). First site has .com->.co.uk redirect, trailing slash fixed on root & subfolders, and homepage removed,
while mysite2 has many redirects:
.co.uk -> .com and my-site -> mysite.com
old php pages -> asp1 pages
Problem is, it seems the rules for mysite2 apply globally, ie on any other site on the server (not mysite2 domain), the rules kick in, and theres a redirect from index.php -> http://www.mysite2.com/index.asp.
Why? I specified the filter only for mysite2 in the rules as you can see, what am i doing wrong?
Either this
rewriteCond %{HTTP_HOST} ^(?!www\.)(.*mysite2.*)$ [NC] or this
rewriteCond %{HTTP_HOST} ^(?!www\.)(.*mysite2.*)$ [NC]
seems to apply the rule below it globally instead of just mysite2 domain.
Code:
RewriteEngine On
# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule ^/httpd(?:\.ini|\.parse\.errors).*$ / [NC,F,O]
# Block external access to the Helper ISAPI Extension
RewriteRule ^.*\.isrwhlp$ / [NC,F,O]
# RewriteCond Host: (.*)
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.*mysite1.*)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [NC,R=301]
# 301 redirect all .com to .co.uk
RewriteCond %{HTTP_HOST} ^(?:www\.)?mysite1\.com$
RewriteRule ^(.*?)(?:index\.asp)?$ http://www.mysite1.co.uk$1 [NC,R=301]
RewriteCond %{HTTP_HOST} ^(?:www\.)?mysite1\.co\.uk$
RewriteRule ^(.*?)index\.asp$ http://www.mysite1.co.uk$1 [NC,R=301]
#Fix missing trailing slash char on folders
RewriteRule ^([^.?]+[^.?/])$ $1/ [R=301,L]
####################################################################
###########mysite2 RULES FOR OLD->NEW SITE 301##################
####################################################################
#redirect old domains to main one
rewriteCond %{HTTP_HOST} ^(?:www\.)?my-site2|mysite2\.co\.uk [NC]
rewriteRule ^(.*)$ http://www.mysite2.com$1 [R=301,L]
#redirect non-www
rewriteCond %{HTTP_HOST} ^(?!www\.)(.*mysite2.*)$ [NC]
rewriteRule ^(.*)$ http://www.mysite2.com$1 [R=301,L]
#redirect old pages to new ones
RewriteCond %{HTTP_HOST} ^www\.mysite2\.com$
RewriteRule ^/extras/wando.php http://www.mysite2.com/content.asp?content=something$1 [R=301]
RewriteRule ^/search2.php http://www.mysite2.com/search.asp1 [R=301]
#RewriteRule ^/index.asp$ http://www.mysite2.com/$1 [R=301]
RewriteRule ^/holiday/info.php$ http://www.mysite2.com/content.asp?content=what\ is\ included$1 [R=301]
RewriteRule ^/about_us.php$ http://www.mysite2.com/content.asp?content=about\ us$1 [R=301]
RewriteRule ^/contact/index.php$ http://www.mysite2.com/contact.asp1?flag=available$1 [R=301]
RewriteRule ^/extras/faq.php$ http://www.mysite2.com/content.asp?content=faqs$1 [R=301]
RewriteRule ^/extras/privacy.php$ http://www.mysite2.com/content.asp?content=privacy\ policy$1 [R=301]
RewriteRule ^/hirecar/.*$ http://www.mysite2.com/content.asp?content=car\ hire$1 [R=301]
RewriteRule ^//holiday/bookcond.php$ http://www.mysite2.com/content.asp?content=booking\ conditions$1 [R=301]
RewriteRule ^/holiday/flights.php$ http://www.mysite2.com/content.asp?content=flights$1 [R=301]
RewriteRule ^/holiday/index.php$ http://www.mysite2.com/content.asp?content=how\ to\ book$1 [R=301]
RewriteRule ^/holiday/insure.php$ http://www.mysite2.com/content.asp?content=holiday\ insurance$1 [R=301]
RewriteRule ^/holiday/transfer.php$ http://www.mysite2.com/content.asp?content=transfers$1 [R=301]
RewriteRule ^/holiday/winter.php$ http://www.mysite2.com/offers.asp$1 [R=301]
RewriteRule ^/index.php$ http://www.mysite2.com/index.asp$1 [R=301]
RewriteRule ^/resorts/alg.php$ http://www.mysite2.com/region-guide.asp?destination=1$1 [R=301]
RewriteRule ^/resorts/cal.php$ http://www.mysite2.com/region-guide.asp?destination=2$1 [R=301]
RewriteRule ^/resorts/cep.php$ http://www.mysite2.com/region-guide.asp?destination=8$1 [R=301]
RewriteRule ^/resorts/cre.php$ http://www.mysite2.com/region-guide.asp?destination=7$1 [R=301]
RewriteRule ^/resorts/cyp.php$ http://www.mysite2.com/region-guide.asp?destination=3$1 [R=301]
RewriteRule ^/resorts/jav.php$ http://www.mysite2.com/region-guide.asp?destination=4$1 [R=301]
RewriteRule ^/resorts/men.php$ http://www.mysite2.com/region-guide.asp?destination=5$1 [R=301]
RewriteRule ^/resorts/pol.php$ http://www.mysite2.com/region-guide.asp?destination=6$1 [R=301]
RewriteRule ^/search.php$ http://www.mysite2.com/search.asp1$1 [R=301]
RewriteRule ^/updates/index.php$ http://www.mysite2.com/content.asp?content=special\ req$1 [R=301]
RewriteRule ^/resorts.php$ http://www.mysite2.com/index.asp$1 [R=301]
RewriteRule ^/updates/offers.php$ http://www.mysite2.com/offers.asp$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.mysite2\.com$
RewriteCond %{QUERY_STRING} resort=(.*)
RewriteRule ^/updates/late_red.php?(.*) http://www.mysite2.com/reductions.asp1?resort=%1 [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^www\.mysite2\.com$
RewriteCond %{QUERY_STRING} resort=(.*)
RewriteRule ^/list_villas.php?(.*) http://www.mysite2.com/destination.asp?destination=%1 [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^www\.mysite2\.com$
RewriteCond %{QUERY_STRING} villa=(.*)
RewriteRule ^/villa_desc.php?(.*) http://www.mysite2.com/villa-details.asp?villa=%1 [R=301,NC,L]
#Fix non-www
#RewriteCond %{HTTP_HOST} ^mysite2\.
#RewriteRule (.*) http://www.mysite2.com$1 [R=301,L] |
|
|
Edited by papachumba - 23 June 2008 at 10:29am
|