I am trying to redirect people, that try to access a specific folder on web to receive 404
Example: if anyone wants to access www.mysite/myfolder/
I wish that person to receive 404 error
What I have tried by now:
RewriteCond %{REQUEST_URI} ^/node/$
RewriteRule .* - [F]
RedirectMatch 301 www.yoursite/node/
RewriteEngine on
RewriteRule ^//node/123 /node/999 /node/128173/(.*)$ /pages/errors/404.php$1 [R=301,L]
None of those really worked-received 500 error
Also tried to simply redirect everything to a non-existent site, like this:
Options +FollowSymLinks
RewriteEngine On
Redirect 301 /node/*.* http://www.your imaginary site/to-new-url
Yet, still received 500
Can anyone please help?
2
Answers
Hi all and thank you for answering my 500 error was apparently due to not specifying https in the redirect form After that everything worked
Why not deny access to /node/ folder?
or modify your rewrites in .htaccess to:
But it’s not good practice, 404 page should return HTTP 404 status not HTTP 301 as redirect.