Home > Article > Backend Development > How to hide url in php
How to set up php hidden url: first find and open the ".htaccess" file; then configure the rule as "RewriteEngine on RewriteRule ^RegStuds/ regstuds.php" and save it.
Recommended: "PHP Video Tutorial"
Specific questions:
Is it possible to hide the URL in the web browser address bar so that it does not necessarily match the location of the file. For example, this URL:
http://localhost/exp/regstuds.php
You will always know where to find files on your computer. Is it possible to twist or scramble or hide the URL in a way that doesn't reveal the file location?
Solution:
If you are hosting your php on an Apache server , you might be able to use the mod_rewrite utility. You can do this, add a rule to your .htaccess file...
RewriteEngine on RewriteRule ^RegStuds/ regstuds.php
This will cause http://localhost/RegStuds/ to actually render regstuds.php, but not in the address bar Show it. If you are on IIS you can use ISAPI rewrite filters to perform the same function. If you don't have mod_rewrite or ISAPI rewrite filters, you can get similar results using a folder structure, so you will have a physical path to RegStuds/index.php - and you will never need to link to "index.php" because it is the default file. This is the least recommended approach.
The above is the detailed content of How to hide url in php. For more information, please follow other related articles on the PHP Chinese website!