Use htaccess file to change url variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
davidhopkins
Forum Commoner
Posts: 41
Joined: Thu Jun 10, 2010 7:52 am

Use htaccess file to change url variables

Post by davidhopkins »

Hello all.

I am trying to get to grips with htaccess files and being able to change how it reads variables.

Currently i have to use www.mydomain.com/Users/id=8 where 8 can be any number from 1-1000.

but what i want is the URL to look like www.mydomain.com/Users/8 so people can view their own profiles or others without having to remember the id bit

Thanks in advance

David
KCAstroTech
Forum Commoner
Posts: 33
Joined: Sat Aug 27, 2011 11:16 pm

Re: Use htaccess file to change url variables

Post by KCAstroTech »

It looks like you are already rewriting "/Users/" somewhere seeing as there is no (?). If you could post your .htaccess file it would help us better understand your situation. Also, look here (http://corz.org/serv/tricks/htaccess2.php) at the section titled "not-so-simple rewriting ... flat links and more." That should give you some ideas to get started on.
Post Reply