Welcome to WebmasterWorld Guest from 54.224.200.104

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirect old domain to new one

     
4:57 pm on Oct 8, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 2, 2005
posts: 112
votes: 0


I try 301, i thought i ll redirect all pages to new domain but all old pages gives 404 except homepage

here is my .htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ http://www.mynewdomain.com/ [R=301,L]

Is this code wrong or something is missing please.I just want all my ex pages redirect to new home page.
Thanks

[edited by: jdMorgan at 11:15 pm (utc) on Oct. 8, 2007]
[edit reason] De-linked [/edit]

11:10 pm on Oct 8, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


You don't need the RewriteCond, since it doesn't do anything in your code anyway, and you do need to add a back-reference, so that the requested page is requested from the new domain:

RewriteEngine on
RewriteRule (.*) http://www.mynewdomain.com/$1 [R=301,L]

Jim
11:49 pm on Oct 8, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 2, 2005
posts: 112
votes: 0


Ok i changed the code thanks but not understand what back-reference means, can you or someone give an example please .I renamed all pages ( was using a cms )and delete some of them so redirecting them to new homapage fine with me .
12:51 am on Oct 9, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


See back-reference as described under the RewriteRule directive in the Apache mod_rewrite documentation [httpd.apache.org]

Jim