Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirect from one domain to another

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

10+ Year Member

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]
4:36 am on Apr 23, 2010 (gmt 0)

10+ Year Member

Code was messed up:

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

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

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.

Featured Threads

Hot Threads This Week

Hot Threads This Month