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: rewriting host header Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
kelvin
Newbie
Newbie


Joined: 10 August 2008
Location: New Zealand
Online Status: Offline
Posts: 1
Posted: 10 August 2008 at 4:05pm | IP Logged Quote kelvin

Hi,

I'm just trying to get a handle on how host rewriting works; I want to have a site called test.cms make it so that if the user tries to access publictest.cms then behind the scenes it will rewrite to test.cms (while still showing publictest.cms in the browser address bar).

I've setup a site with a host header test.cms and put a helloworld.htm file in it.

In my hosts file I've set
127.0.0.1     test.cms
127.0.0.1     publictest.cms

then in my ISAPI rewrite httpd.conf file I've put both these:

RewriteCond %{HTTP:Host} publictest\.cms
RewriteHeader Host: .* test\.cms

RewriteCond Host: publictest\.cms
RewriteHeader Host: .* test\.cms

When I load test.cms I can see the helloworld.htm fine, and I would have expected to also be able to put publictest.cms/helloworld.htm - but that doesn't work (gives a 404).  I thought behind the scenes it would rewrite publictest.cms to test.cms.

Any suggestions on what I'm doing wrong?

Thanks,
Kelvin.
Back to Top View kelvin's Profile Search for other posts by kelvin
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Online
Posts: 4839
Posted: 11 August 2008 at 4:41am | IP Logged Quote Anton

Guess you are using ISAPI_Rewrite3. Then your config should be like this:

RewriteCond {HTTP_HOST} ^(?:www\.)?publictest\.cms$
RewriteRule (.*) http://test.cms$1 [NC,P]


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

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 can vote in polls in this forum