SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Somewhere in the Middle East
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    301 redirecting dynamic pages problem with a twist

    Hi everyone at sitepoint,

    I would like to 301 redirect some dynamically generated PHP pages. Placing the following code in my .htaccess file would normally work very well:

    RewriteCond %{QUERY_STRING} [&]?id=goat[&]?
    RewriteRule ^oldsite\.php$ http://www.mysite.com/newsite.php? [R=301,L]

    However the problem I have is that I have changed the name of the variable on the new page (the variable's value remains the same however). For example, I want to redirect:

    http://www.mysite.com/oldsite.php?id=goat TO
    http://www.mysite.com/newsite.php?animal=goat

    I can't do this with the above code as I can't change the variable name, only the name of the domain and page. Any ideas?

    MANY, MANY thanks,

    Leao

  2. #2
    SitePoint Enthusiast rashedirshad's Avatar
    Join Date
    Sep 2009
    Location
    Rawalpindi, Pakistan
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try to use this


    RewriteCond %{QUERY_STRING} [&]?animal=goat[&]?
    RewriteRule ^oldsite\.php$ http://www.mysite.com/newsite.php?animal=goat [R=301,L]
    Khan
    _______________________
    http://www.peoplesourceinternational.com/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •