.htaccess redirection tips

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

illu_htaccess

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.

Let’s do these step to create a redirection by .htaccess file.

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

2. 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:

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:

Redirect index.html to a specific subfolder:

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

MORE POWERFUL URL CHANGES WITH MOD_REWRITE

If you need to make complex changes to the way your URL displays, you should visit Using .htaccess rewrite rules. You can do things like add “www” to the beginning of your URL, redirect all requests to a subfolder but keep the rest of the URL, etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

CDN by MaxCDN