i was unable to find answer, so there it is:
i need to get URL like this: //mydomain/index.php?var=username (or https:// if user want secure connection).
To use nice URL I want to use: //mydomain/user/username (this should stay in the browser URL line) to get: //mydomain/index.php?var=username
I have configured .htaccess to:
RewriteEngine on
RewriteBase /
RewriteRule ^user/([^/]+)/?$ /index.php?var=$1 [L]
But it doesn’t work. When i use redirection [R,L] it works fine, but in the URL line of browser is the ugly URL after it 🙁
Please can You help me, what i have wrong?
Your comment
Describes normal (expected) behaviour. Your browser thinks the page is being served from //mydomain/user/userid so all relative links will be resolved using the base path //mydomain/user/. What’s more, your htaccess rule allows an optional trailing slash so //mydomain/user/userid/ is also valid. A request like that will resolve all links relative to //mydomain/user/userid/, so an href of “foo.html” will point to //mydomain/user/userid/foo.html.
The only real solution here is to make all your links relative to the root folder by adding a “/” at the start. For instance, instead of things like:
You should use