: Methods to provide user data to web application in URL? I am aware that one method to provide user data to web application is to use query strings. For example http://www.example.com/get-page.php?home=aaa.html
I am aware that one method to provide user data to web application is to use query strings. For example www.example.com/get-page.php?home=aaa.html would set variable home value to aaa.html and this is used in script get-page.php. Obviously, one could write anything instead of aaa.html and it is up to web application developer to check the input. According to this thread some web servers read the filename part of the URL and direct the request to some internal function. However, both methods use query strings. Are there any other methods besides query strings which allow user to provide random data to web application in URL?
More posts by @Vandalay111
1 Comments
Sorted by latest first Latest Oldest Best
If your server is apache with mod_rewrite installed, then you can use friendly urls that map to real urls with the query strings then users only see the friendly urls.
Here's some code to put in .htaccess:
RewriteEngine On
RewriteRule ^section/(.*)$ /path/to/specialpage.php?section= [L]
Basically what these lines do is allow one to put in a friendly URL in the format of example.com/section/whatever where whatever is any text. When executed, the URL actually being processed is /path/to/specialpage.php?section=whatever because of the which means take the value located at the position of (.*).
To understand the detailed meaning of .*, you may want to look up regex (regular expressions).
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.