Basically, when a user types in http://www.domain.com/username I want it to go to http://www.domain.com/user?u=username. Username is the name of the user whose page I want to visit. How can I do this? Do I need to make a URL rewrite? Is there a better way to do this? On almost all websites that involve user pages, you can simply type in something like YouTube.com/channel and Facebook.com/username. I want to be able to do that on my site. I am using php for my user pages.
Asked
Active
Viewed 65 times
1
-
http://stackoverflow.com/questions/18162686/url-rewrite-get-parameters. Make sure that you include [QSA] (Query String Append) if you are looking to pass get params across – FamiliarPie Apr 09 '14 at 01:37
-
2There are at least 20 questions exactly like this everyday. Have you considered using the search function up top to check for similar questions? – Ohgodwhy Apr 09 '14 at 01:40
1 Answers
0
What you would need is to have an hypertext access file (.htaccess). This file will allow you to use URL rewriting. Here is what you would need to put inside that file:
RewriteEngine On
RewriteRule ^([^/]*)$ /user?u=$1 [L]

0x9BD0
- 1,542
- 18
- 41
-
This didn't work for me. It just comes up with a 404 when I try to go to http://www.domain.com/
– Apr 10 '14 at 00:35 -