how redirect pages using .htaccess
nav_first.pngFirst: blog:1
Private Server Community
Edited: 05 Jun 2017 17:47 by: Slater River
Comments: 0
Tags: aqwps partner plasmily private-server shutdown slater-river
nav_prev.pngPrevious: blog:8
connecting a database to your website using php and msql database
Edited: 18 Jun 2017 00:09 by: Slater River
Comments: 0
Tags: connect database db mysql mysqli pdo php
nav_last.pngLast: blog:15
calling out to all programmers
Edited: 14 Sep 2017 17:33 by: Slater River
Comments: 0
Tags: apply calling css html javasript out php programmers requirements skills
nav_next.pngNext: blog:10
new website template design
Edited: 08 Jul 2017 21:22 by: Slater River
Comments: 0
Tags: contact css design develop html project structure tables website

Slater RiverSlater River wrote on 04 Jul 2017 19:43
Tags: content guide help .htaccess instructions redirect

Using a .htaccess file is very helpful and very powerful. This post will explain how to create a .htaccess file to redirect your content.

Read Me First

As a configuration file, .htaccess is very powerful. Even the slightest syntax error (like a missing space) can result in your content not displaying correctly or at all.

Since .htaccess is a hidden system file, please make sure your FTP client is configured to show hidden files. This is usually an option in the program's preferences/options.

Instructions

  1. Create an empty text file using a text editor such as notepad, and save it as htaccess.txt.

NOTE:

The reason you should save the file as htaccess.txt is because many operating systems and FTP applications are unable to read or view .htaccess files by default. Once uploaded to the server you can rename the file to .htaccess.

  1. Edit the contents of the file. Check the following examples:

301 (Permanent) Redirect: Point an entire site to a different URL on a permanent basis. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the "mt-example.com" domain:

# This allows you to redirect your entire website to any other domain
Redirect 301 / http://mt-example.com/

302 (Temporary) Redirect: Point an entire site to a different temporary URL. This is useful for SEO purposes when you have a temporary landing page and plan to switch back to your main landing page at a later date:

# This allows you to redirect your entire website to any other domain
Redirect 302 / http://mt-example.com/

Redirect index.html to a specific subfolder:

# 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:

# Redirect old file path to new file path
Redirect /olddirectory/oldfile.html
http://example.com/newdirectory/newfile.html
Redirect to a specific index page:

# Provide Specific Index Page (Set the default handler)
DirectoryIndex index.html

  1. Upload this file and re-name it to .htaccess.

If you are using a plain text editor than be sure to save it as a plain textfile.

Add a New Comment
or Sign in as Wikidot user
(will not be published)
- +
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License