Thread Rating:
  • 0 Vote(s) - 0 Average
Share Thread:
How to 301 redirect properly?
#7
Redirect to www using htaccess redirect:
Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to <!-- w --><a class="postlink" href="http://www.domain.com">www.domain.com</a><!-- w -->
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)

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ <!-- m --><a class="postlink" href="http://www.domain.com/$1">http://www.domain.com/$1</a><!-- m --> [r=301,nc]

Please REPLACE domain.com and <!-- w --><a class="postlink" href="http://www.newdomain.com">www.newdomain.com</a><!-- w --> with your actual domain name.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)