php - I want HTACCESS to block only direct access to a specific file -


i have file don't want users able navigate on own accord. however, if click link sends them there, it's okay page work. have htaccess file set so.

<files "success.php"> order allow,deny deny </files> 

success.php name of file, , in directory of success.php, have following in htaccess file:

rewriterule /?\.htaccess$ - [f,l] rewriterule ^/?admin/paypal/success\.php$ - [f,l] 

will users still able success.php if they're directed there, because know you're shown 403 error if try navigate there.

if case blocked being directed there, there way can fix this?

when type url "success.php" in browser's location bar , hit enter, browser sends request success.php.

when go website , click on link takes me "success.php", browser sends request success.php.

it's same, because click on link on site vs typing in browser, both requested same. when deny access, deny access. need check "referer" header, browsers can (optionally) include in request let webserver know url came from. referers can forged or omitted, checking referer isn't guarantee.

rewriteengine on rewritecond %{http_referer} !^https?://example.com/ [nc] rewriterule ^admin/paypal/success\.php$ - [f,l] 

so if loads page on "example.com" site (e.g. site) , clicks on link goes success.php page, they'll fine. other access anywhere else 403.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -