How to hide url in php

藏色散人
Release: 2023-03-06 17:28:01
Original
3375 people have browsed it

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.

How to hide url in php

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!