There can be a case when you want to restrict any request methods for your website. Restrict in the sense you don’t want user to perform that action. Different Request methods available are as below:
So now we all know that most used Request Methods are GET and POST and in your application you needs only these two methods available in that case you can disable rest of the Request Methods just by placing a single line of code in .htaccess file.
After placing below code in htaccess file, user will get Forbidden Error when user has initiated a restricted Request Methods.
Now let’s see how to achieve this.
So after placing this code your application will show forbidden error for the TRACE, TRACK, OPTIONS and HEAD Request Methods.
Hope you enjoyed this small trick for your website. Subscribe to our RSS Feed via Email for more Htaccess Tricks.
Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.
View all posts by: Avinash