Welcome to WebmasterWorld Guest from 54.226.27.104

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirect old domain to new one

     

OldWolf

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

5+ Year Member



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]

jdMorgan

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

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



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

OldWolf

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

5+ Year Member



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 .

jdMorgan

12:51 am on Oct 9, 2007 (gmt 0)

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



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

Jim

 

Featured Threads

Hot Threads This Week

Hot Threads This Month