Connecting Tech Pros Worldwide Help | Site Map

mod_rewrite index.php

  #1  
Old May 18th, 2009, 07:00 PM
Newbie
 
Join Date: Feb 2008
Posts: 20
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
  #2  
Old June 3rd, 2009, 09:47 AM
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,862
Provided Answers: 9

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.
  #3  
Old June 3rd, 2009, 10:08 AM
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,862
Provided Answers: 9

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_rewrite in .htaccess does not work jaanus answers 2 September 15th, 2007 02:28 PM
allow access to folders in spite of mod_rewrite jaimebienlesfruits answers 1 June 6th, 2007 04:56 PM
Mod_Rewrite / Regex to PHP URL Dr. No answers 3 February 15th, 2007 09:15 AM
discussion: script structuring and mod_rewrite? Susanne West answers 2 February 13th, 2007 09:55 AM