Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0 support forum
 Helicon Tech : ISAPI_Rewrite 3.0 support forum
Subject Topic: waht am i doing wrong? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
papachumba
Newbie
Newbie


Joined: 27 January 2006
Location: United Kingdom
Online Status: Offline
Posts: 18
Posted: 23 June 2008 at 8:38am | IP Logged Quote papachumba

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
Back to Top View papachumba's Profile Search for other posts by papachumba
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 3873
Posted: 24 June 2008 at 2:34am | IP Logged Quote Anton

RewriteCond directive is applied to a single consequent rule.
So you should either repeat it before each RewriteRule or use per-site .htaccess files.


__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
papachumba
Newbie
Newbie


Joined: 27 January 2006
Location: United Kingdom
Online Status: Offline
Posts: 18
Posted: 24 June 2008 at 10:36am | IP Logged Quote papachumba

Thanks again, Anton.

I have tried applying site specific rules in separate htaccess files (either through your interface or directly dropping the file in root) but it doesnt seem to enforce the rules?

In the meatime i have fixed it by putting a rewritecond before every rule. I thought they could be grouped.
Back to Top View papachumba's Profile Search for other posts by papachumba
 
Yaroslav
Moderator Group
Moderator Group


Joined: 15 August 2002
Online Status: Offline
Posts: 6445
Posted: 25 June 2008 at 5:51am | IP Logged Quote Yaroslav

You can use <VirtualHost> tac instead of RewriteCond to group rules. And not working .htaccess file point onto insufficient NTFS permissions problem.

__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top View Yaroslav's Profile Search for other posts by Yaroslav Visit Yaroslav's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum