UnitedForums - UK Web Hosting Forum UnitedHosting Community Hosting Forums
Network and Server StatusCustomer SupportUK Web Hosting
UnitedHostingUnitedHosting Sitemap UK Hosting ForumUK Web HostingWeb Hosting ForumsUK Reseller HostingWeb Host CommunityUK Managed Dedicated ServersHosting Help and SupportUK Domain Name Registration

Go Back   UnitedForums.co.uk > UnitedHosting Community > Website Development & Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 8th August 2008, 01:06 PM   #1 (permalink)
savvy
Registered User
 
Join Date: Feb 2008
Location: UK
Posts: 15
Apache redirect absolute urls to a different domain

I've got a problem that I've been having trouble getting my head around all morning!

I'm updating a site for a friend which uses absolute urls, normally when I test a site I've been working on I'll upload it to my server so I can check it without interfering with the normal operation of the actual site - obviously the absolute urls make that difficult in this case.

My plan was to configure a .htaccess file to redirect url requests for friendsite.co.uk to test.mysite.com/friendsite/

but I'm not sure the best way to execute this?

Can I place the htaccess file in mysite.com directing all requests for friendsite.co.uk to test.mysite.com/friendsite/

or do I need to place the htaccess file in friendsite.co.uk directing all requests from referer test.mysite.com to test.mysite.com/friendsite/

Any pointers in the right direction would be appreciated as at the moment I feel as if I'm be "redirected" - round in circles!

cheers
savvy is offline   Reply With Quote
Old 8th August 2008, 09:31 PM   #2 (permalink)
Terra
Registered User
 
Terra's Avatar
 
Join Date: Oct 2005
Location: old cottage
Posts: 938
Redirects always puzzle me but this guide has been my saviour: Best .htaccess Tutorials with Sample .htaccess files

However - I think in your case that's not easy. If you click a link with an absolute URL you'd go to the live site. BUT - you don't want to redirect all traffic from the live site to the dev copy (as it would affect everybody)

Only option may be to apply redirects specifically to your IP address? There are examples in the guide how to filter based on IP addresses. You'd need a fixed IP address & then ensure that only traffic coming from your IP is redirected.

There are examples you can use - they are meant for when a webmaster wants to put a site under maintenance, but they give you the basics: htaccess Tutorial for Apache Webmasters
__________________
Underground, Overground, Wombling Free!
Terra is offline   Reply With Quote
Old 8th August 2008, 10:14 PM   #3 (permalink)
percepts
Senile Member
 
percepts's Avatar
 
Join Date: Mar 2005
Posts: 986
Getting rid of the absolute urls would make life a lot simpler.
__________________
An old dog learning new tricks
percepts is offline   Reply With Quote
Old 9th August 2008, 09:57 AM   #4 (permalink)
savvy
Registered User
 
Join Date: Feb 2008
Location: UK
Posts: 15
Thanks for the advice and the links Terra, unfortunately I can't go with the IP based solution as I need to give my friend access for checking purposes and I don't know what his IP address is and whether it is static.

Thanks percepts, as much as I don't relish the idea of going through the whole site and changing it to relative urls - I've agreed that I'll update the site on a regular basis for him so in the long run it might be the best option.

Thanks again both!
savvy is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 12:16 AM.

UK Web Hosting  |  UK Reseller Hosting  |  UK Dedicated Servers UnitedHosting  |  UnitedSupport  |  UnitedForums  |  SEO by vBSEO 3.0.0
Copyright © 1998-2008 United Communications Limited. All Rights Reserved. Registered in England and Wales 3651923 - VAT Reg No. 737662309