Help with .htaccess

Discussion in 'Programming' started by JSalvador, Sep 23, 2010.

  1. #1
    I'm trying to do a URL rewrite and redirect

    Currently I have the following URLs:
    http://parttimejobsin.us/cities/index.php?id=1
    http://parttimejobsin.us/cities/index.php?var=Accounting&id=1

    In order to rewrite them I used the following code for the .htaccess file:
    That has worked fine for rewriting. However, I now want to 301 redirect the old URLs to the newly rewritten URLs so that there won't be duplicate content on my site.

    In other words, if a user types in:
    http://parttimejobsin.us/cities/index.php?id=1
    I would like them to be automatically 301 redirected to:
    http://parttimejobsin.us/cities/1.html

    Additionally, if a user types in:
    http://parttimejobsin.us/cities/index.php?var=Accounting&id=1
    I would like them to be automatically 301 redirected to:
    http://parttimejobsin.us/cities/Accounting/1.html

    Is this possible to do? Any help would be greatly appreciated!
     
    JSalvador, Sep 23, 2010 IP