Complex Rewrite rule

Discussion in 'Apache' started by paulb100, Nov 29, 2010.

  1. #1
    I wonder if anyone can solve this one for me.

    I have some inbound links to my site which are: www.mysite.com/%20

    these links are generating 404s

    I want to put a rewrite rule in my htaccess to rewrite/redirect this to the root domain,.

    however as %20 is a special character (space) I'm struggling with the syntax.

    anyone have any ideas?
     
    paulb100, Nov 29, 2010 IP
  2. blackvps

    blackvps Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why not use the 404 redirect?

    ErrorDocument 404 /404.php
     
    blackvps, Dec 2, 2010 IP
  3. paulb100

    paulb100 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Well - I actually already have a trap for 404 - to the search page. What I'm trying todo is trap/rewrite the request so it can return a 200 instead.
     
    paulb100, Dec 4, 2010 IP
  4. paulb100

    paulb100 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    got it fixed.

    this was the answer:

    RewriteRule ^\ $ http://example.com/ [R=301,L]
     
    paulb100, Dec 4, 2010 IP