Depending on your server configuration it can be necessary to change the examples for your situation. Always try to understand what it really does before you use it. Bad use would lead to deadloops and will hang the server.
(Page 1 of 6)
This document describes how one can use Apache's mod_rewrite to solve typical Search Engine Optimization (SEO) based problems webmasters are usually confronted with in practice.
The Apache module mod_rewrite is a module which provides a powerful way to do url manipulations.
Not only can mod rewrite be used to avoid duplicate content, redirect moved urls or non existing inbound links, and create search engine friendly urls.
It can also be used for to gain higher PageRank and search engines rankings,
get your web site indexed by the search engines, and receiving more visitors.
We have divided this tutorial in the follow pages:
- Use mod rewrite for SEO purposes
- Avoiding duplicate content with mod rewrite
- Redirect relocated urls with mod rewrite
- Redirect non existing inbound links with mod rewrite
- Search Engine friendly urls with mod rewrite
- mod rewrite for SEO purposes put together
Before you can start using mod_rewrite you need to create a text file named .htaccess and ftp it into your web site root directory. For the Windows users, create a file called htaccess.txt, ftp that to the server, and then rename it to .htaccess.
If you don't know if mod_rewrite is active on your website than can you try it by editing the .htaccess text file and add the follow lines to the file:
Options +FollowSymLinks -MultiViews
RewriteRule ^mod_rewrite\.html$ / [L]
If you open the page
http://www.example.com/mod_rewrite.html in your browser and you main web page is showing than mod_rewrite is active on you web site.
Now that you are so far, we can go forward with avoiding duplicate content with the help of mod rewrite.
NEXT » Avoiding duplicate content with mod rewrite