.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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -