2

I want to prevent access to a folder /workspace/test

I've done this with the following piece of code

RewriteRule ^(workspace/test) / [R=404,L,NC] 

Now I have a second rewrite rule

RewriteRule ^news\/(.*)$ workspace/test/news.php [L,NC] 

The problem it that I get a 404 because of the first rewrite rule.

Is it possible deny access to files if the user enters it in the URL but allow access to these files if I do it with a RewriteRule?

1 Answer 1

0

Use THE_REQUEST variable:

RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\ /workspace/test [NC] RewriteRule ^workspace/test - [R=404,L] RewriteRule ^news/(.*)$ workspace/test/news.php [L,NC] 
Sign up to request clarification or add additional context in comments.

1 Comment

@rapre if the post helped mark it as an answer. The question won't appear in unanswered questions list.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.