Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: redirecting for certain files only Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
lo0kash
Newbie
Newbie


Joined: 04 December 2007
Online Status: Offline
Posts: 15
Posted: 29 June 2010 at 6:24am | IP Logged Quote lo0kash

Hello,

I need to redirect all requests excluding css, js, jpg etc files to different domain, so I have:

RewriteCond  Host:  (?:www\.)?domain\.com
RewriteRule (?!.*\.(?:css|jpg|gif|zip|js|png|jpeg|txt|pdf)).* http\://www.redirectdomain.com [I,RP,L]

This works ok for http://www.domain.com/robots.txt
(stays on domain)
but not for http://www.domain.com/robots.txta - it stays on domain.com and displays 404. Expected behaviour is that it should be redirected to www.redirectdomain.com
I've tried to remove .* from the end of the rule but that didn't help.
It works ok for http://www.domain.com/robots.test - requests is redirected to www.redirectdomain.com.

Thanks in advance

Lo0kash
Back to Top View lo0kash's Profile Search for other posts by lo0kash
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10489
Posted: 29 June 2010 at 9:28am | IP Logged Quote Anton

So you also want to account for misprints. Please try it like this:

RewriteCond Host: (?:www\.)?domain\.com
RewriteRule (?!.*\.(?:css|jpg|gif|zip|js|png|jpeg|txt|pdf).*).* http\://www.redirectdomain.com [I,RP]

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


Joined: 04 December 2007
Online Status: Offline
Posts: 15
Posted: 29 June 2010 at 9:47am | IP Logged Quote lo0kash

Thanks Anton,

/robots.txta still causes 404 being served from the original domain.
Anyway, this is no longer a problem for me, thanks for your help.


Back to Top View lo0kash's Profile Search for other posts by lo0kash
 

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