hassank1 Posted November 7, 2011 Share Posted November 7, 2011 Hi I am working on a website where the change of the id (index.php?id=x) will lead to a different profile information based on the 'x' value till now, things are very simple, however, I want to change that so instead of example.com/index.php?id=x , I want to write example.com/userX similiar to when facebook create usernames instead of just a profile id I know that I can create directories each time dynamically (like user1,user2,etc... all directories) but isn't there another method where the links are virtual and not real directories ? so I can get the link and compare it with a database, instead of each time creating a directory then placing an index file inside of it that will redirect to the specific id ? ex : (db table) id name 1 user1 2 user2 etc.. Link to comment https://forums.phpfreaks.com/topic/250616-examplecomuser1-instead-of-examplecomindexphpid1/ Share on other sites More sharing options...
Adam Posted November 7, 2011 Share Posted November 7, 2011 Yup, it's called the Apache "mod_rewrite" module. It allows you to specify regular expression based patterns that the server will check for on requests. I dare say if you search for "mod rewrite cheat sheet" or something, you'll find what you're after. Link to comment https://forums.phpfreaks.com/topic/250616-examplecomuser1-instead-of-examplecomindexphpid1/#findComment-1285835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.