Create page with URL like domainname/users in php

Hello,

Can anyOne tell me how to create a profile with unique address like www.xyz.com/users . Where users is the profile that we may create in php registration form.

Kindly help me which strategy i can use for this??

Thanks

you can use htaccess for this

http://httpd.apache.org/docs/1.3/howto/htaccess.html

by combining the rewrite module of php and htaccess you can get this result

Thanks for your reply.

Could you please tell me how can i use it at my localhost?? Like i am using WAMP for my php hosting.

One more thing… I just need to paste this code in .htaccess file?? just?? WHat RewriteEngine do?? What Rewrite Rule??

RewriteEngine On

RewriteRule ^users/?$ user_management.php [NC,L]

Thanks Alot for your quick response.

Left click the WAMP icon in your taskbar and then Apache > Apache Modules and click rewrite_module, wait till all the services restart then because your running WAMP open your FTP client and on your desktop create a .htaccess file, cut it and paste it where you need the rewrite to work.

NOTE: Windows does NOT allows the creation of files with periods in the name as the first letter so we need to always use a third party program to create one

Yes just copy that code i posted but change user_management.php to the file that will manage your user system. Here’s what the following basically mean…

RewriteEngine
- This initiates the rewrite_module engine allowing or disallowing rewrite rules depending if its set to On or Off

RewriteRule - This sets a rule for the rewrite_module engine to execute, there’s a bunch of arguments you can give this command which you can read about by googling it

Basically what you would want to use is mod_rewrite, its something I’ve only recently begun learning but have got a good go on.

First go to http://www.addedbytes.com/for-beginners/url-rewriting-for-beginners/ and read about it as it did help myself and then do the following.

Make a .htaccess file on your server (only if one doesn’t exist, check via your FTP software as most hosts disable the ability to see this file via a cPanel), next add the following to it

RewriteEngine On

RewriteRule ^users/?$ user_management.php [NC,L]

What this will do is allow you to in your browser go to www.mysite.com/users and behind the scenes it really goes to user_management.php or whatever file you need it to go to. That’s all that’s really to it, others here might supply better solutions but this is one that worked for me quite well