Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Redirect 301 using RewriteCond? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
techwiz
Newbie
Newbie


Joined: 30 December 2009
Location: India
Online Status: Offline
Posts: 6
Posted: 30 December 2009 at 6:17am | IP Logged Quote techwiz

Hi,

I am a complete noob to htaccess and stuff...please help
me

I have 2 pages /page1.html and /page2.html
I want it to redirect them to
http://www.secondwebsite.com/page1.html and
http://www.secondwebsite.com/page2.html respectively.

For all other pages I want to use:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.firstwebsite.com/$1 [R=301,L]

How can I do it?

Thanks in advance.
Back to Top View techwiz's Profile Search for other posts by techwiz Visit techwiz's Homepage
 
Vyacheslav
Admin Group
Admin Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 1535
Posted: 30 December 2009 at 7:48am | IP Logged Quote Vyacheslav

Hello,
Please try the following rules:
Code:
RewriteBase /
RewriteRule ^page1\.html$ http://www.secondwebsite.com/page1.html [NC,L]
RewriteRule ^page2\.html$ http://www.secondwebsite.com/page2.html [NC,L]


__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
techwiz
Newbie
Newbie


Joined: 30 December 2009
Location: India
Online Status: Offline
Posts: 6
Posted: 01 January 2010 at 4:09am | IP Logged Quote techwiz

Worked a treat!
You rock!

one more thing...
this directory /something should not be redirected under any circumstances.
how can I do that?
Back to Top View techwiz's Profile Search for other posts by techwiz Visit techwiz's Homepage
 
Vyacheslav
Admin Group
Admin Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 1535
Posted: 04 January 2010 at 10:00am | IP Logged Quote Vyacheslav

Hello,
Sorry for delay. We had holidays.

Would you please provide more specific example.
Thanks.

__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
techwiz
Newbie
Newbie


Joined: 30 December 2009
Location: India
Online Status: Offline
Posts: 6
Posted: 04 January 2010 at 10:16am | IP Logged Quote techwiz

No problems at all... :)

I'm using this code right now
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.firstwebsite.com/$1 [R=301,L]


This thing redirect all my links to firstwebsite.com.
I have a directory called /folder ... this shouldn't get redirected

any file (say /folder/blah_blah.html) in /folder shouldn't get redirected anywhere.

Thanks a lot,
Suhas


Back to Top View techwiz's Profile Search for other posts by techwiz Visit techwiz's Homepage
 
Vyacheslav
Admin Group
Admin Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 1535
Posted: 05 January 2010 at 10:12am | IP Logged Quote Vyacheslav

Hello,
I just noticed that this is ISAPI_Rewrite 2 forum, but since all my suggestions work for you I guess you have ISAPI_Rewrite 3. Is it true?
I'll give you solutions for both versions:
2nd
Code:
RewriteRule (?!folder/)(.*) http\://www.firstwebsite.com/$1 [RP,L]


3rd
Code:
RewriteRule (?!folder/)(.*) http://www.firstwebsite.com/$1 [R=301,L]


Edited by Vyacheslav - 05 January 2010 at 10:12am


__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
techwiz
Newbie
Newbie


Joined: 30 December 2009
Location: India
Online Status: Offline
Posts: 6
Posted: 12 January 2010 at 6:09am | IP Logged Quote techwiz

I am really sorry for the late reply. I was busy with my
exams.

I tried this
Code:
RewriteRule (?!folder/)(.*)
http\://www.firstwebsite.com/$1 [RP,L]

but I was greeted with a 500 internal server error. So,
its definety not ISAPI_Rewrite 2.
This, sadly, dint work
Code:
RewriteRule (?!folder/)(.*)
http://www.firstwebsite.com/$1 [R=301,L]

I seriously dont know why.
Am I doing anything wrong?

Thanks,
Suhas
Back to Top View techwiz's Profile Search for other posts by techwiz Visit techwiz's Homepage
 
Vyacheslav
Admin Group
Admin Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 1535
Posted: 12 January 2010 at 10:16am | IP Logged Quote Vyacheslav

Hello,
Would you like me to look at your system in order to try and fix the issue?
You may send login credentials to support@helicontech.com.

__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
techwiz
Newbie
Newbie


Joined: 30 December 2009
Location: India
Online Status: Offline
Posts: 6
Posted: 30 January 2010 at 11:56am | IP Logged Quote techwiz

Hi,

I am horribly sorry for the late reply..

noob here...so donno where to put the code..

is this right?

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.firstwebsite.com/$1 [R=301,L]
RewriteRule (?!folder/)(.*) http://www.firstwebsite.com/$1 [R=301,L]



Back to Top View techwiz's Profile Search for other posts by techwiz Visit techwiz's Homepage
 
Vyacheslav
Admin Group
Admin Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 1535
Posted: 01 February 2010 at 1:56am | IP Logged Quote Vyacheslav

Hello,
Please try the following configuration:
Code:
RewriteCond %{REQUEST_URI} (.*)
RewriteCond %1 !/folder.* [NC]
RewriteRule .? http://www.firstwebsite.com%1 [NC,L,R=301]


__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
techwiz
Newbie
Newbie


Joined: 30 December 2009
Location: India
Online Status: Offline
Posts: 6
Posted: 09 February 2010 at 2:04am | IP Logged Quote techwiz

Super awesome!!
thanks for helping a noob..

take care,
Suhas
Back to Top View techwiz's Profile Search for other posts by techwiz Visit techwiz'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