: How to make parameters look more attractive I'm making a blog site and instead of the users blogs being called /blog?display=username I would like it to just be a sub domain such as mysite.com/username
I'm making a blog site and instead of the users blogs being called /blog?display=username I would like it to just be a sub domain such as mysite.com/username
How would I be able to make the first URL look like the second URL?
More posts by @Ann8826881
3 Comments
Sorted by latest first Latest Oldest Best
You can use the PATH_INFO variable. More here: httpd.apache.org/docs/2.0/mod/core.html
Previous answer (using Request.PathInfo) was tarted at asp.net -- thanks for pointing that out.
You are probably looking for mod_rewrite. It's easy, just put this in your .htaccess file.
RewriteEngine On
RewriteRule ^(.*)$ /blog?display=
Place this in your .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /blog?display= [L]
This will redirect each URL which do not corresponds to an existing file (!-f) or existing directory (!-d) to the corresponding blog?... URL. [L] makes the rewriting stop here (in case you have more rules). See the mod_rewrite Guide for details.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.