mod_rewrite index.php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • theoni
    New Member
    • Feb 2008
    • 20

    #1

    mod_rewrite index.php

    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
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    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.

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Actually, you don't need rewrite conditions.

      Try this:

      Code:
      RewriteEngine On
      
      RewriteRule ^index\.php(.*)?$ /$1 [R=301]

      Comment

      Working...