Reputation: 5729
The standard GET query as a link for each user is easy but ugly for the users and search engines.
// This looks UGLY
website.com/index.php?userid=43232
//This is what I want
website.com/coolUser
How to make a custom link for every user without creating folders all the time?
Upvotes: 0
Views: 279
Reputation: 3608
Simple way to make URL like that, using .htaccess (create .htaccess file and upload to your public_html / wwwdir)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9a-zA-Z-]+)/?$ index.php?userid=$1 [L]
Now, you can access http://yoursite.com/43232 OR http://yoursite.com/index.php?userid=43232
Upvotes: 0
Reputation: 13166
What you mentioned called "clean URL", and what you need something known as "mod-rewrite" capability in Apache configuration.
Sergei and Zulkhaery direct you to it with their comments. Also you can take a look at the link below: http://wettone.com/code/clean-urls
But don't forget you may see some problems with you css, js, and image files. But they have their own solutions too. You can find them if you get these problems.
Upvotes: 1