.htaccess File to Redirect Traffic at Server Level

By | January 23, 2012 at 2:24 pm | No comments | Domaining, Tutorials | Tags: , , , , , , , , , , , , , , , , , , , , , , , ,

This code will only affect users trying to hit your website at “/” or “/index.html”. If a user attempts to find a page called “/test” their browser will return a 404. This .htaccess file is very useful for search engine bots to know this domain forwards to another as quick as possible without violating any terms of service.

To start, create a text file, call it “htaccess.txt”.

  • Add the following code from below
  • Change the domain name to the domain you want it to redirect to
  • Upload your file to your web server
  • Depending on your apache config, Change the filename from “htaccess.txt” to “.htaccess”
  • Enjoy your new direct

# Redirect
Redirect 301 /index.html http://www.yourdomainhere.com

© 2012 Richard Ricketts, rricketts.com. All rights reserved.