how to make seo friendly URLs using .htaccess

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dhruvjha
    New Member
    • Mar 2010
    • 3

    how to make seo friendly URLs using .htaccess

    I'd like to take the following URL:



    and turn it into : http://www.website.com/about-us

    and aso http://www.website.com/about-us.php

    I have read / seen many tutorials, but none of them seems to work.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Moved to the Apache forums.

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Hey.

      The module used to do that is called mod_rewrite. It re-routes incoming requests based on regular expression patterns.

      This tutorial explains it pretty well.
      - http://articles.sitepoint.com/articl...rl-rewriting/2

      You will also need to know the basics about regular expressions if you plan to use mod_rewrite. This site is one of the best regular expression resources out there.
      - http://www.regular-expressions.info/tutorial.html

      Comment

      • dhruvjha
        New Member
        • Mar 2010
        • 3

        #4
        Thank you,

        But again, they are keeping products.php as base..., and it didn't help me......

        Please, if you know it, just give me the code to accomplish this....., that's all i need.

        Again thanks for those links, they are really useful..

        Comment

        • dhruvjha
          New Member
          • Mar 2010
          • 3

          #5
          I am still waiting for the answer, please help... :)

          Comment

          • Atli
            Recognized Expert Expert
            • Nov 2006
            • 5062

            #6
            Originally posted by dhruvjha
            Please, if you know it, just give me the code to accomplish this.....
            We don't do that. We are here to help you create code, not to do it for you.
            Post what you have tried, and I will help you make it work.

            I'll help you get started, though. This regular expression will match either of the URLs you want to match.
            [code=text]^about-us(\.php)?$[/code]

            With that, and a basic understanding of how mod_rewrite works (which you can get by reading the tutorial I posted), you should have no problem creating the rewrite rule you need.

            Comment

            Working...