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: Rewrite masking question Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
seb835
Newbie
Newbie


Joined: 11 January 2008
Online Status: Offline
Posts: 21
Posted: 30 July 2008 at 9:36am | IP Logged Quote seb835

Hi there.

In my scenario I have the following setup:

Website A: www.training-centres.co.uk
Website B: centres.training-centres.co.uk

As you can see, website A holds the main website containing general training information, and website B is a sub-domain of website A and holds lots of pages for each training centre which just shows a map.

My current situation is this:

www.training-centres.co.uk - this goes to the main site and is OK
www.training-centres.co.uk/London - this goes to the centres.training-centres.co.uk url (website B) with "London" as a querystring variable.

All that is perfectly fine and works perfectly.

What I would like to do is to keep the www.training-centres.co.uk/London url, even though technically we have jumped form website A to website B.

Is this possible to do?

I would very much appreciate any help.
Thank you, Seb


Edited by seb835 - 30 July 2008 at 9:37am
Back to Top View seb835's Profile Search for other posts by seb835
 
Vyacheslav
Moderator Group
Moderator Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 673
Posted: 30 July 2008 at 10:29am | IP Logged Quote Vyacheslav

Hi Seb.
You can try this solution:
Code:
RewriteCond %{HTTP:Host} ^www\.training-centres\.co\.uk$ [NC]
RewriteRule ^/London(.*)$ centres.training-centres.co.uk$1 [NC,L]


__________________
Kind regards!
Vyacheslav Shinkarenko, HeliconTech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 
seb835
Newbie
Newbie


Joined: 11 January 2008
Online Status: Offline
Posts: 21
Posted: 05 August 2008 at 9:17am | IP Logged Quote seb835

Hello, thanks for that solution but it does not work.

That ends up with a URL like centres.training-centres.co.uk/London, when what I am looking for is www.training-centres.co.uk/London (but with the content that is found at centres.training-centres.co.uk/London).

Is this at all possible?

Thank you.
Back to Top View seb835's Profile Search for other posts by seb835
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 4837
Posted: 06 August 2008 at 2:28am | IP Logged Quote Anton

Please try to use this rules:

RewriteCond %{HTTP_HOST} ^www\.training-centres\.co\.uk$ [NC]
RewriteRule ^(/London.*)$ http://centres.training-centres.co.uk$1 [NC,P]

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


Joined: 11 January 2008
Online Status: Offline
Posts: 21
Posted: 06 August 2008 at 4:11am | IP Logged Quote seb835

Hello,

This latest rule seems to work OK, i now get:

www.training-centres.co.uk/London

(showing the content from the other server - centres.training-centres.co.uk/London) which is great!

But, does this over-ride the other server's rewrite .htaccess file? The rewrite rules on the other server don't seem to have any effect anymore - so for example these two show the same page which is wrong:

www.training-centres.co.uk/London - index.php
www.training-centres.co.uk/London/parking.html - index.php

This is the rewrite rule im using on the main site:

Code:

RewriteCond %{HTTP_HOST} ^www\.training-centres\.co\.uk$ [NC]
RewriteRule ^([A-Za-z0-9-]+).*$ http://centres.training-centres.co.uk/index.php?client_id=${map:$1} [NC,P]


Thanks again for your help!
Back to Top View seb835's Profile Search for other posts by seb835
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 4837
Posted: 06 August 2008 at 7:44am | IP Logged Quote Anton

Sorry, I haven't completely understood your problem. Can you please explain in more details what configs and where do you have, what each of them is supposed to do, and provide examples of initial and rewritten urls you want to obtain.


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


Joined: 11 January 2008
Online Status: Offline
Posts: 21
Posted: 06 August 2008 at 8:41am | IP Logged Quote seb835

Ok sorry my fault for not explaining properly.

I have siteA.com and siteB.com.

siteA is a normal website so it has pages like:

siteA.com/aboutus.html
siteA.com/welcome.html

...but if certain city names are entered as URLs like:

siteA.com/London

...then it jumps to siteB.com/index.php?city=London

It does this using a rewrite map.

What I want is to be able to go to siteA.com/London, and show the content under siteB.com/index.php?city=London, while still keeping the siteA.com/London url.

I also need to be able to go to siteA.com/London/map.html, which in reality would really be something like siteB.com/index.php?city=london&structure_id=5

SiteA and SiteB both have their own .htaccess files containing their own rules.

Your latest suggestion worked perfectly, up to the point where i wanted to browse the pages on siteB like siteA.com/London/map.html

It seems like while the URL mask is working fine, it is ignoring the rules on siteB

Does this help explain things a bit more?
Back to Top View seb835's Profile Search for other posts by seb835
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 4837
Posted: 07 August 2008 at 3:50am | IP Logged Quote Anton

Thanks for your explanation!
So the rule works ok when you go siteA.com/London (it sends you to siteB.com/index.php?city=London), but when you are already on siteB you cannot browse it, right?
Can you please show you .htaccess for siteB and content of map file for siteB.


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


Joined: 11 January 2008
Online Status: Offline
Posts: 21
Posted: 07 August 2008 at 4:45am | IP Logged Quote seb835

Yes you are correct.

Here is the .htaccess for SiteB:

Code:

# Helicon ISAPI_Rewrite configuration file
# Version 3.0.0.25


RewriteEngine on
RewriteBase /


RewriteMap lower int:tolower
RewriteMap mapfile txt:centres_rewrite_map.txt
RewriteCond ${mapfile:${lower:$1}|NOT_FOUND} ^(?!NOT_FOUND)(.*)$
RewriteRule ^([A-Za-z0-9-]+)/?$ /index.php?client_id=$1


#Index
RewriteRule ^index.html$ /index.php [L]


#Learning
RewriteRule ^charlottes-test-centre-learning\.html$ /index.php?structure_id=46 [L]


And here is the rewrite map for SiteB:

Code:

aberdeen 1
ashford 2
basingstoke 3
bath 4
bishopsstortford 6
boston 7
brighton 8
london 9


Also, here is the .htaccess for SiteA:

Code:

# Helicon ISAPI_Rewrite configuration file
# Version 3.0.0.25

RewriteEngine on
RewriteBase /

#=========================================================================
# Rewrite Rules [L]=last rule, stop execution
#=========================================================================

#-------------------------------------------------------------------------
# Rewrite Map - checks if a centre name was entered in the URL
#-------------------------------------------------------------------------
RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteMap map int:tolower
RewriteCond %{HTTP_HOST} ^pitman-test\.propserver4\.com$ [NC]
RewriteRule ^([A-Za-z0-9-]+).*$ http://centres.pitman-test.propserver4.com/index.php?client_id=${map:$1} [NC,P]
#-------------------------------------------------------------------------

#-------------------------------------------------------------------------
# RSS Feed
#-------------------------------------------------------------------------
RewriteRule ^feed\.xml$ /scripts/rss_news_feed.php [L]

# home footer / misc
RewriteRule ^terms-conditions\.html$ terms.php [L]
RewriteRule ^privacy-policy\.html$ privacy.php [L]
RewriteRule ^our-story\.html$ our-story.php [L]
RewriteRule ^accessibility\.html$ accessibility.php [L]
RewriteRule ^sitemap\.html$ sitemap.php [L]

# Locations
RewriteRule ^centres\.html$ centres.php [L]

# News
RewriteRule ^news\.html$ news.php [L]
RewriteRule ^news/page_([0-9]+)\.html$ news.php?cur_page=$1 [L]
RewriteRule ^news/page_([0-9]+)/([A-Za-z0-9-]+)/?(lite-site)?\.html$ news.php?cur_page=$1&safe_link=$2&lite-site=$3 [L]


Thank you so much for your help!
Back to Top View seb835's Profile Search for other posts by seb835
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 4837
Posted: 07 August 2008 at 9:25am | IP Logged Quote Anton

Could you please provide rewrite log records for the request on siteB and the testing url you are using.


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


Joined: 11 January 2008
Online Status: Offline
Posts: 21
Posted: 12 August 2008 at 11:17am | IP Logged Quote seb835

Hello, sorry for the delay.

Sorry but I cannot provide the logs.

All I'm trying to do here is mask the URL of SiteB.

It doesnt seem like this is possible with this system because using your masking techniques above means that the rewrite rules of SiteB are ignored - since it still thinks we are in SiteA.
Back to Top View seb835's Profile Search for other posts by seb835
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 4837
Posted: 13 August 2008 at 9:44am | IP Logged Quote Anton

So after you get to SiteB (masked as SiteA) you want the config residing on SiteB to be applied?


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


Joined: 11 January 2008
Online Status: Offline
Posts: 21
Posted: 13 August 2008 at 10:00am | IP Logged Quote seb835

Hello, yes thats exactly correct 

That would solve so many problems for me.

Thank you kindly.
Back to Top View seb835's Profile Search for other posts by seb835
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 4837
Posted: 14 August 2008 at 8:46am | IP Logged Quote Anton

Probably your problem is due to incorrect links.
By the way, is it possible to see your problem online?


__________________
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