#1
  1. Awake and listening...
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Location
    Berlicum, the Netherlands
    Posts
    127
    Rep Power
    14

    Editing .htaccess, 301 redirect link with variables


    I want to redirect an old page (http://www.website.com/page.php?id=47) to a new page (http://www.website.com/redirectpage/). For some reason the code I used does not work. My rewrite engine does work, because other RewriteRules work correctly.

    What can I do to fix this problem?

    PHP Code:
    RewriteEngine On

    RewriteBase 
    /
    RewriteRule ^page.php?id=47(.*)$ /redirectpage/$[R=301,L
    People who get a raise because of their good work have been underpayed for quite some time.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Posts
    345
    Rep Power
    14
    It's not working because you are setting the variable on the url you want to mask and not the main url that is shown to the user.
    Try -
    PHP Code:
    RewriteEngine On 
    RewriteBase 

    RewriteRule ^p-(.*)$ /page.php?id=$[R=301,L
    So if you entered in yoursite.com/p-47

    it would be the same as entering in yoursite.com/page.php?id=47

    That is assuming that the .htaccess file is in the root directory.

    Jaz
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2010
    Posts
    1
    Rep Power
    0

    301 redirect with


    Hi,
    I have been in 4 forums and found no help, the best help I think is in your post... Could you help with the following?


    I want to redirect index.php?option=com_content&task=view&id=70&Itemid=82 (that no longer exists) to /folder1 address using a 301 php redirect.

    I'm familiar with a oldpage.html to a newpage.html, but ?option....I'm looking to do this for several ?options variants.

    Thanks in advance!!!

IMN logo majestic logo threadwatch logo seochat tools logo