mod_rewrite for dynamic urls

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
mattcooper
Forum Contributor
Posts: 210
Joined: Thu Mar 17, 2005 5:51 am
Location: London, UK

mod_rewrite for dynamic urls

Post 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 :)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

You can always write another rule.

Code: Select all

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