redirect 301 wild card?

Discussion in 'Apache' started by mahmood, Aug 10, 2007.

  1. #1
    I had the following redirect for a while:
    RewriteRule ^oldPage/(.*)$ oldPage.php?name=$1
    PHP:
    Now I have changed "oldPage" with newPage so the new rewriterule would be:
    RewriteRule ^newPage/(.*)$ newPage.php?name=$1
    PHP:
    How do I redirect 301 all old pages to new pages? Is there a kind of wild card to do that instead of indivisually. Obviously this is not a good option:
    Redirect 301 oldPage/(.*)$ http://www.mydomain.com/newPage.php?name=$1
    PHP:
    because want a user friendly url and unfortunately this isn't working:
    Redirect 301 oldPage/(.*) http://www.mydomain.com/newPage/(.*)
    PHP:

     
    mahmood, Aug 10, 2007 IP
  2. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #2
    RedirectMatch 301 /oldPage/(.*)$ http://www.mydomain.com/newPage/$1
     
    VimF, Aug 10, 2007 IP
    mahmood and explorer like this.