1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Welcome to GadgetBit!

We are a community of technology enthusiats.

If you are already a registered member then you can login here

If you are new to the site then why not join up? It will only take a couple of minutes to register, by doing so all adverts will be removed from the site. You can register here or you can use your Facebook or Twitter account.

How do I redirect my site using a .htaccess file?

By Creaky · Oct 11, 2015 ·
  1. Creaky
    This document will explain how to create a .htaccess file to redirect your site or site content. This will not redirect any emails for your domains.
    1. Create an empty text file using a text editor such as notepad, and save it as htaccess.txt.[/*]
    2. If using a text editor, be sure to save the file as plain text.[/*]
    3. Edit the contents of the file. Check the following examples:[/*]
    Point an entire site to a different URL, such as domain.net redirected to domain.com:
    Code:
    # This allows you to redirect your entire website to any other domain Redirect 301 / http://example.com/
    Redirect index.html to a specific subfolder:
    Code:
    # This allows you to redirect index.html to a specific subfolder Redirect /index.html http://example.com/newdirectory/
    Redirect an old file to a new file path:
    Code:
    # Redirect old file path to new file path Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html
    Redirect to a specific index page:
    Code:
    # Provide Specific Index Page (Set the default handler) DirectoryIndex index.html
    The definitive guide on Apache directives that can be used in .htaccess files can be found here: http://httpd.apache....s/mod/core.html.

    Share This Article