.htaccess - Allow access only if URL matches exactly -


i have file (www.sample.com/sample.json).

i file accessed url (www.sample.com/sample.json?custom-text).

if it's accessed without custom-text, want redirect homepage or show forbidden error.

i do not want make changes site www.sample.com. want changes file, sample.json (www.sample.com/sample.json)

i'm new .htaccess, sorry if terms used wrong. in advance.

you can use rule:

rewriteengine on  rewritecond %{query_string} !^custom-text$ [nc] rewriterule ^sample\.json$ - [f,nc] 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -