Home > seo > SEO URL, .htaccess Rewrite Rules

SEO URL, .htaccess Rewrite Rules

September 28th, 2009

Problem

You have a portal that you had developed a while ago. When your portal was designed, you did not know about Search Engine pPtimization. The pages of your portal looked like

http://www.referencedesigner.com/cat.php?i=3&page=2

http://www.referencedesigner.com/cat.php?i=3&page=3

This obviously is not a user friendly url. The url forms one of the most basic parameter for the page to be optimized. You will rather like the pages to contain the keywords that represents the content of the pages. If your portal is still at the beginning stage, try to see if you can modify your url so that it represents a SEO friendly url.

What if your portal has hundreds or thousands of pages already there and it is not possible for you to make changes.

The Solution

Fortunately .htaccess and the rewrite rules and solve your problem is many situations – or you may like to give it a try.

The .htaccess file is a special file that enables you to control how your hosts server deals with your website and webpages. .htaccess is used for several kind of redirection, including 404 page redirection and 301 redirection. Before you start making changes to .htaccess, make yourself known to facts about .htaccess. Errors in .htaccess files can be lead to serious issues.

The .htaccess file is sometimes not visible from your FTP program. So you may like to use your host’s cpanel to see this file, access it and modify it.

Here is an example of how .htaccess file can be used to change the url.

url that needs to be forwarded

http://www.referencedesigner.com/stories/3/Barak-Obama-New-President/2.html

The url to which the contents are sourced

http://www.referencedesigner.com/story.php?id=3

Here is a typical Rewrite Rule that will accomplish this task.

RewriteRule ^stories/([0-9]+)/[a-z0-9_-]*\.html$ /story.php?id=$1 [QSA,L,NC]

Note that this will also require changes in the website. Often a little bit of tweek here and there serves the purpose. But you may have to take the help of a specialist SEO cum developer to achieve the result.

.htaccess is a powerful tool. If you care about the SEO and redirections in your website, you must know how to use it.

seo

  1. andy
    December 26th, 2009 at 16:22 | #1
  2. January 24th, 2010 at 05:49 | #2

    i need url in sitemap name-name.html
    but im getting board php like that
    how i can redirect this one

  3. February 10th, 2010 at 12:32 | #3

    Thanks for providing such a clear explanation. I have tried to understand this before but never got my head round it. ta

  4. February 25th, 2010 at 09:28 | #4

    i need sitemap seo using .htacess , can you help me out please

  1. No trackbacks yet.