htaccess redirect every request to root? catch all..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    htaccess redirect every request to root? catch all..

    Hi,

    I have been trying to redirect request to any of the pages on an "under-construction" website to root.

    e.g. redirect www.example.com/randomxyz to www.example.com

    I wrote this code, but didn't seem to work. Any suggestions?
    Code:
    RedirectMatch ^([.]+)$ http://www.example.com
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    I'm not all that used to using RedirectMatch, but that kind of looks like an indefinite loop to me.
    It redirects everything to example.com, even example.com.

    Try something like
    Code:
    RedirectMatch ^http://www.example.com.+$ http://www.example.com
    P.S.
    I've moved this over to the Apache forums.

    Comment

    • hsriat
      Recognized Expert Top Contributor
      • Jan 2008
      • 1653

      #3
      No success man... still the infinite loop.


      Anyway... don't worry... I'm not implementing it now.

      Thank you :)

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        I think you may need the extra / in there at the end of the .com in the match side. Maybe that will help?
        Also possible the http://-etc does not appear i nthe match behavior?
        Code:
        RedirectMatch ^http://www.example.com/.+$ [url]http://www.example.com[/url]
        Anything good here?
        If you've moved a few pages or even a whole site, here are a few ways to get your visitors to where they were going by automatically redirecting them.

        Comment

        Working...