Redirecting with PHP
Copy the source code and edit "http://www.new-url.com" with your own url and save it as a .php filePHP Code:<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>
301 Redirect with .htaccess
Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
Please REPLACE domain.com and www.newdomain.com with your actual domain name.PHP Code:Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Live demo[my site]: http://www.craigafer14.co.uk
Notice that you got redirected to http://.craigafer14.co.uk
Hope these helped and please rep me if they did![]()


LinkBack URL
About LinkBacks

Reply With Quote


