T
T
tostera2020-07-12 15:53:35
PHP
tostera, 2020-07-12 15:53:35

How can I disable access to a file via a direct link?

I need get.php to open from a link
http://test.ru/a/b
But not from a direct link
http://test.ru/get.php
Is it possible to do this with htaccess?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
no_one_safe, 2020-07-12
@no_one_safe

You can put a redirect.

T
ThunderCat, 2020-07-12
@ThunderCat

Routing + mod_rewrite.

D
dodo512, 2020-07-12
@dodo512

RewriteEngine on

RewriteCond %{THE_REQUEST} ^\S+\s+/get\.php
RewriteRule ^get\.php$ - [F]

RewriteRule ^a/b$ /get.php [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question