homepage Welcome to WebmasterWorld Guest from 54.237.71.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Redirect from one domain to another
JohnKelly




msg:4120456
 4:32 am on Apr 23, 2010 (gmt 0)

I know this is an extremely common question, and I've done my search and come up with code. What I want to do is have any request for [images.olddomain.com...] to alias to [images.newdomain.com...]

Is it possible to do this without a browser or search engine "knowing" they're at images.newdomain.com (i.e. file displayed is from images.newdomain.com but URL bar still shows images.olddomain.com)?

Here is the code I have which I've seen used on many searches, yet doessn't work. Do I need to have images.olddomain.com setup or not?

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^images.olddomain.com$ [NC]
RewriteRule ^(.*)$ [images.newdomain.com...] [R=301,L]

 

JohnKelly




msg:4120460
 4:36 am on Apr 23, 2010 (gmt 0)

Code was messed up:


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^images.olddomain.com$ [NC]
RewriteRule ^(.*)$ http://images.newdomain.com/$1 [R=301,L]

g1smd




msg:4120485
 5:31 am on Apr 23, 2010 (gmt 0)

The above code is for a redirect. A redirect forces the browser to make a new request for a new URL.

Use example.com to stop the forum reformatting your code.

If both domains are on the same server, you might use an internal rewrite instead of an external redirect.

If they are on different servers, use a Proxy but be aware that will slow the site down and will mess up the logging and analytics.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved