Home >Backend Development >PHP Problem >How to hide url in php

How to hide url in php

藏色散人
藏色散人Original
2020-10-16 09:21:103650browse

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

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!

Statement:
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 admin@php.cn