Redirect test(dot) to www(dot)

All you need to do for this is simply to create the subdomain required and create two files. The code within the files are below.

Advertisements

.htaccess

RewriteEngine on

RewriteCond %{HTTP_HOST} ^test.yourdomain.co.uk$ [OR]

RewriteCond %{HTTP_HOST} ^www.yourdomain.co.uk$

RewriteRule ^/?$ “http\:\/\/yourdomain\.co.uk” [R=301,L]

 

ErrorDocument 404 /notfound.php

 

notfound.php

<?php

header(‘HTTP/1.1 301 Moved Permanently’);

header(‘Location: http://www.yourdomain.co.uk’.$_SERVER[“REQUEST_URI”]);

?>

 

Tags:

Comments are closed

Latest Comments

No comments to show.