mod Rewrite - old directory has spaces in name

Discussion in 'Apache' started by Simon, Nov 17, 2008.

  1. #1
    Hi There,

    I've inherited a site that has spaces in all the directory names.

    how do i escape the spaces in the below so it will work.

    RewriteRule ^/Ngai Tahu Whanui/Natural Environment/Customary Fisheries/Regulations http://www.ngaitahu.iwi.nz/Ngai-Tahu-Whanui/Natural-Environment/Customary-Fisheries/ [R=301,L]

    if possible please write all the code i will need.

    I'ts my first day doing this.

    thanks in advance,
    Any help appreciated.
    Regards,
    simon.
     
    Simon, Nov 17, 2008 IP
  2. Tropp

    Tropp Well-Known Member

    Messages:
    108
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Never tried it personally but I would suggest to try putting quote marks " " around the whole spaced directory structure
     
    Tropp, Nov 18, 2008 IP
  3. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #3
    Escape the space with a backslash.

    RewriteRule ^/Ngai\ Tahu\ Whanui/Natural\ Environment/Customary\ Fisheries/Regulations ...
    Code (markup):
     
    joebert, Nov 18, 2008 IP
  4. Simon

    Simon Peon

    Messages:
    57
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Awesome Joebert.

    Tested and it works.

    I spent all day looking for the solution and couldn't fine it anywhere.

    Very much appreciated.
     
    Simon, Nov 18, 2008 IP