Page 1 of 1

mod_rewrite for dynamic urls

Posted: Fri Dec 29, 2006 7:03 am
by mattcooper
Hi all,

I've got the following in htaccess:

Code: Select all

RewriteEngine on

RewriteRule ^(.*)\.html ./index.php?id=$1
RewriteRule ^(.*)\.htm ./index.php?idsub=$1
When we navigate to the root of the site, ie "http://www.sitename.co.uk", we'd normally expect a redirect to index.html, or whatever is set on the server. However, with the mod_rewrite, we go nowhere, when we should be landing on "index.php?id=1".

It's a simple one, but I don't know the answer, so can somebody give me a nudge in the right direction?

Cheers :)

Posted: Sat Dec 30, 2006 12:18 pm
by John Cartwright
You can always write another rule.

Code: Select all

RewriteRule ^index\.html$ ./index.php?id=index [L]