How to use mod_rewrite to rewrite a URL like this?

Discussion in 'HTML & Website Design' started by finqoo, May 12, 2010.

  1. #1
    finqoo, May 12, 2010 IP
  2. 50plus

    50plus Guest

    Messages:
    234
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Unless your example urls are already obtained with mod rewrite, I'm somewhat puzzled why you want to use mod rewrite for this.
    Just create a directory called wood in your website's root directory and put your pages pine.html and oak.html in that new directory and you will have the url that you want.
     
    50plus, May 12, 2010 IP
  3. finqoo

    finqoo Well-Known Member

    Messages:
    319
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #3
    But if I do that my pictures and images don't display properly.
     
    finqoo, May 12, 2010 IP
  4. 50plus

    50plus Guest

    Messages:
    234
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If your pages pine.html and oak.html AND the images/pictures shown on these pages are now in the root directory of your website then move the images/pictures together with the pages into your new wood directory and they will display.
    Equally if there are other "things" that show on these pages, then move them as well.
     
    50plus, May 12, 2010 IP
  5. styla786

    styla786 Member

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    On some webservers there are more than one URL for a resource. Usually there are canonical URLs (which should be actually used and distributed) and those which are just shortcuts, internal ones, etc. Independent of which URL the user supplied with the request he should finally see the canonical one only.
     
    styla786, May 13, 2010 IP
  6. mrhelena

    mrhelena Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Set the code in your .htaccess file.
     
    mrhelena, May 13, 2010 IP
  7. mrpaisa

    mrpaisa Guest

    Messages:
    741
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks for sharing!
     
    mrpaisa, May 24, 2010 IP