.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
Post a Comment