K
K
KromKR2016-02-11 13:51:40
PHP
KromKR, 2016-02-11 13:51:40

PHP site security + .htaccess?

Redirected requests using htaccess:
RewriteRule ^viewpost/([-a-zA-Z0-9_]+)/? viewpost.php?id=$1 [L]
Now I want to deny access to the file via: ./viewpost.php?id=1
i.e. leave only: ./viewpost/1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey, 2016-02-11
@KromKR

RewriteRule ^viewpost\.php?id=\d+ /403.html [R=301,L]

E
Evgeny Svirsky, 2016-02-11
@e_svirsky

A good direction was suggested by Vladlen Ultra . Make a single entry point to the index.php application and then work with REQUEST_URI. So it will be right and safe and beautiful :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question