301 rewrite

HI chaps, i dont know if im tried or blatantly thick…how do i create a permanent 301 redirect from old to new domain

At the mo i use:

Redirect 301 / http://newsite.com/

However if i go to oldsite.com/oldpage.php i get redirected to newsite.com/oldpage.php (which doesnt exist and therefore page not found)…

How do i redirect to the homepage of the new site, irrelevant of the old url site string?

Thanks in advance

That’s actually exactly how it ought to work.

Well, if I want to direct all old content to one new page…I.e home page of new site…


I’d say that your Redirect statement is correct so I don’t know why the %{REQUEST_URI} string was passed, too.

When all else fails, I fall back on mod_rewrite. This should settle the trick for you:

# .htaccess in DocumentRoot of old website 
RewriteEngine on
RewriteRule .? http://newsite.com/ [R=301,L]

IF the two domains share the same DocumentRoot (the new one parked on the old one),

# .htaccess in DocumentRoot of old website 
RewriteEngine on
RewriteCond %{HTTP_HOST} oldsite[COLOR="#A9A9A9"]\\.com[/COLOR] [NC]
# the \\.com isn't required if oldsite domain name is not contained in the newsite domain name
RewriteRule .? http://newsite.com/ [R=301,L]



301 URL rewrite is only work in Htaccess file.you have to create new rule in htacces to change old path to new path.This is the code

RewriteCond %{HTTP_HOST} ^(abc\.com|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$ [NC]
RewriteRule ^ http://www.sbc.com%{REQUEST_URI} [L,NE,R=301]