htaccess redirect

Discussion in 'Apache' started by zdvolode, May 20, 2006.

  1. #1
    zdvolode, May 20, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Which do you want, this-is-a-test/, or thisisatest/? You can't redirect a visitor to two different URLs.

    You can only make both of the URLs show the this is a test/ stuff, or redirect to one URL.

    Even better, change the script to add - to spaces in URLs. Search and replace would do it.
     
    Nintendo, May 20, 2006 IP
  3. zdvolode

    zdvolode Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thisisatest, would better suit me

    If you could write the code it would be apreciated, all my experimenting

    didn't make the trick
     
    zdvolode, May 20, 2006 IP
  4. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #4
    I'm not sure how well spaces go with mod_rewrite.

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^.]+) ([^.]+) ([^.]+) ([^.]+)/$ http://www.domain.com/$1$2$3$4/ [R=301,L]
    RewriteRule ^([^.]+) ([^.]+) ([^.]+)/$ http://www.domain.com/$1$2$3/ [R=301,L]
    RewriteRule ^([^.]+) ([^.]+)/$ http://www.domain.com/$1$2/ [R=301,L]

    If this is from a script, I think the normal

    RewriteRule ^([^.]+) ([^.]+) ([^.]+) ([^.]+)$ whatever.php?cat=$1&subcat=$2&page=$3 [L]

    would also need to be in the code.
     
    Nintendo, May 20, 2006 IP