Connecting Tech Pros Worldwide Forums | Help | Site Map

mod_rewrite index.php

Newbie
 
Join Date: Feb 2008
Posts: 20
#1: May 18 '09
I need some help with something I am trying to solve here and cannot find anything online

I need to mod_rewrite to redirect with 301 to remove duplicate content from google the following:

www.site.com/courses/index.php?cat=89&start=0
to
www.site.com/courses/?cat=89

and at the same time redirect only the
www.site.com/courses/index.php to
www.site.com/courses/

i cannot do it I have been trying for hours
any help?

thank you

Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,947
#2: Jun 3 '09

re: mod_rewrite index.php


Check out rewrite conditions - they're a lot like programming conditionals.

Also, you may not know this, but /index.php?var=x is the same as /?var=x, because, if your server is set up correctly, it will show a default page (index.php) if no page (just a directory) is requested. However, I may not be understand your problem.

- mark.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,947
#3: Jun 3 '09

re: mod_rewrite index.php


Actually, you don't need rewrite conditions.

Try this:

Expand|Select|Wrap|Line Numbers
  1. RewriteEngine On
  2.  
  3. RewriteRule ^index\.php(.*)?$ /$1 [R=301]
  4.  
Reply