Mod Rewrite with PHP question

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
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

Mod Rewrite with PHP question

Post by amir »

Hello how would you write a .htaccess modrewrite to do the following.

I simply want to be able to form my urls like this:

http://www.domainname.com/item1/item2

and it will rewrite to do the following:

http://www.domainname.com/index.php?page=item1&id=item2

Can someone please tell me how to write this mod rewrite?

thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There've been a lot of posts concerning that. Take a look around in this (Apache, IIS, Web Servers) board.
User avatar
ibbo
Forum Commoner
Posts: 51
Joined: Tue Sep 19, 2006 6:20 am

Post by ibbo »

Code: Select all

RewriteEngine on
RewriteRule (.*)/(.*)/ ?page=$1&id=$2
Your URL would look like http://www.domainname.com/item1/item2/

ibbo
ianhull
Forum Contributor
Posts: 310
Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK

Post by ianhull »

Where would I put this code?

Code: Select all

RewriteEngine on 
RewriteRule (.*)/(.*)/ ?page=$1&id=$2
thanks.
Post Reply