How to Deny Access to Specific URL in htaccess?
Hello,
This tutorial will provide example of how to deny access to specific url in htaccess. In this article, we will implement a htaccess deny access to specific url. you'll learn htaccess deny access to specific path. This post will give you simple example of htaccess block access to specific url.
If you need to block some specific url for all then you can do it using .htaccess file, i will give you following examples, how to do that.
let's see following solution.
Example 1:
you can not access "your_website/test.html" directory.
.htaccess
RewriteEngine On
RewriteRule ^test.html$ - [F]
Example 2:
you can not access "your_website/data/test.php" directory.
.htaccess
RewriteEngine On
RewriteRule ^data/test.php$ - [F]
you can see layout as bellow:
i hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Whitelist/Allow IP Address using .htaccess File?
- How to Restrict/Block IP Address using .htaccess File?
- How to Clone Laravel Project from Github on Server?
- How to Generate and Add SSH Key in Github?
- How to Generate SSH Key in Ubuntu Server?
- How to Check Apache Access & Error Log Files in Ubuntu Server?
- How to Whitelist/Allow IP Address in Apache Ubuntu?
- How to Restrict/Block IP Address in Apache Ubuntu?
- How to Set Up Password Authentication with Apache in Ubuntu?