.htaccess redirect url

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xiaawan
    New Member
    • May 2007
    • 17

    #1

    .htaccess redirect url

    Hi All I am posting this message again I could not get too much help from my previous post. This time I want to make things simple.
    www.example.com/index/command/message/1
    www.example.com/index/command/message/2
    how can I convert above urls to the following one(same for all)
    www.example.com/command
    Whever text after (index/command/message/1), I want it to convert
    www.example.com/command
    Please help. Thanks in advance.
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    Originally posted by xiaawan
    Hi All I am posting this message again I could not get too much help from my previous post. This time I want to make things simple.
    www.example.com/index/command/message/1
    www.example.com/index/command/message/2
    how can I convert above urls to the following one(same for all)
    www.example.com/command
    Whever text after (index/command/message/1), I want it to convert
    www.example.com/command
    Please help. Thanks in advance.
    You could use mod_rewrite or mod_proxy or mod_alias to do this. But the more favorable way would be to use the language which you programmed the rest of your site in to provide a HTTP Redirect so that search engines appropriately handle this as well.

    Comment

    • xiaawan
      New Member
      • May 2007
      • 17

      #3
      Dear thank you very much for your reply. Although my requirement is changed by the client but I try it for my future knowledge. Again thank you very much. :)

      Comment

      • Motoma
        Recognized Expert Specialist
        • Jan 2007
        • 3236

        #4
        Originally posted by xiaawan
        Dear thank you very much for your reply. Although my requirement is changed by the client but I try it for my future knowledge. Again thank you very much. :)
        You are quite welcome. Come back any time you have a question.

        Comment

        • xiaawan
          New Member
          • May 2007
          • 17

          #5
          Dear few days back I asked a question about .htaccess. Now I have anohter question. How can I use .htaccess at localhost. I have searched on the net but did not get any useful help. My system is having windows and I am using Apache. How can I use .htaccess to redirect urls on localhost.
          for example:
          my actual url is as follows:
          http://localhost/site/index/contact/message/1 and I want it to convert as follows
          http://localhost/site/contact/1
          Thanks in Advance.

          Comment

          • Motoma
            Recognized Expert Specialist
            • Jan 2007
            • 3236

            #6
            Originally posted by xiaawan
            Dear few days back I asked a question about .htaccess. Now I have anohter question. How can I use .htaccess at localhost. I have searched on the net but did not get any useful help. My system is having windows and I am using Apache. How can I use .htaccess to redirect urls on localhost.
            for example:
            my actual url is as follows:
            http://localhost/site/index/contact/message/1 and I want it to convert as follows
            http://localhost/site/contact/1
            Thanks in Advance.
            You would do this the same way you would do it for the outside, through use of mod_rewrite.

            Comment

            Working...