Manuel Smith
Manuel Smith

Reputation: 11

How to set 403 Forbidden on single page via .htaccess

How to use 403 forbidden for 1 single page. I have been using the following code below on directory level like on my WordPress site /wp-content/, /wp-includes/ & it works. But How to achieve for a single file like /example-service.html so that when anyone visit the page /example-service.html it returns 403 forbidden (in .htaccess)

<files>
order allow, deny
deny from all
</files>

Upvotes: 1

Views: 600

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

You can use the following RewriteRule to redirect /example-service.html to 403 error.

RewriteEngine On

RewriteRule ^example-service.html$ - [R=403]

Upvotes: 1

Related Questions