Redirect 301 Hosting Linux

emilix123

Junior Member
Joined
Apr 14, 2010
Messages
161
Reaction score
2
Hi guys I would like to know the code to perform a 301 redirect on my site to another site? I have a Hosting Linux

Thanks
 
put this in index.php
PHP:
<?php
header('Location: http://www.example.com/');
?>

Or put this in .htaccess file (this will redirect all urls):
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldsite\.com\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://newsite.com/$1 [R=301,L]

Next time use google to find a solution
 
Last edited:
Thanks for the reply sorry but I must make a redirect from a subdomain (name.domain.com) to a external domain (site.com) the code in .htaccess file is the same?

because don't work....
 
Back
Top