homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Redirect old domain to new one

 4:57 pm on Oct 8, 2007 (gmt 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.

[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)

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]



 11:49 pm on Oct 8, 2007 (gmt 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)

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


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