Author Topic: mod_rewrite  (Read 874 times)

lekky

  • Autococker
  • Posts: 2449
mod_rewrite
« on: August 11, 2008, 05:14:05 PM »
Struggling with mod_rewrite rules. I'll keep having a go, but if anyone knows how to write these would be a big help :P

Basically want to redirect any url in the form:

www.website.co.uk/index.php/*

to:

www.website.co.uk

KnacK

  • Global Moderator
  • Autococker
  • Posts: 3039
Re: mod_rewrite
« Reply #1 on: August 11, 2008, 05:58:16 PM »

Zorchenhimer

  • Autococker
  • Posts: 2614
Re: mod_rewrite
« Reply #2 on: August 12, 2008, 12:09:10 PM »
You don't need a rewrite rule to do that, at least not if you do it right in "index.php".  For instance "http://www.zorchenhimer.com/?pg=pics" is really "http://www.zorchenhimer.com/index.php?pg=pics".  Unless you want "clean URLs" like Drupal does, in which case you will need to use some rewrite rules.

lekky

  • Autococker
  • Posts: 2449
Re: mod_rewrite
« Reply #3 on: August 12, 2008, 04:34:23 PM »
I have clean urls at the moment, eg http://www.indiereview.co.uk/reviews/

The problem is the old "clean" urls eg http://www.indiereview.co.uk/index.php/table/latest-reviews/ which are indexed on google. They go to a blank page so I need to rewrite anything index.php/* to go to my home page! Or even better to a custom 404 page explaining the link has changed.

lekky

  • Autococker
  • Posts: 2449
Re: mod_rewrite
« Reply #4 on: August 12, 2008, 06:00:04 PM »
ok, sorted with a little (lot) help from sk89q. A rewrite rule was added to direct everything in the bad form to the 404 page.