I have a directory called /admin
- the most predictable name for an admin panel. As of right now I have created a fake directory called /ase
using htaccess. When you go to the url, you have to log in to the admin panel. When you're not logged in to /ase
, and you visit /admin
, it will say 404 not found.
My htaccess is this:
RewriteEngine On
RewriteRule ^ase admin/allseeingeye/
But people can still visit admin/allseeingeye/
to log in which is located on /admin
. Is there a PHP script like:
if (url = admin/allseeingeye/) {
error 404 script
} else {
// rest of the page
}
But so the page still functions on /ase
?
The script above is completely wrong but that's just to explain.
You don't need a PHP script for this, you can do so in mod_rewrite
itself using a separate rule:
RewriteEngine On
# forbid direct request to allseeingeye
RewriteCond %{THE_REQUEST} /allseeingeye/ [NC]
RewriteRule ^ - [L,R=404]
RewriteRule ^ase/?$ admin/allseeingeye/ [L,NC]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.