I am trying to stop access to two certain folders with this .htaccess code:
RewriteEngine On
RewriteRule ^(nigel/|multicraft/) - [F,L,NC]
I get a 500 Internal Server Error when I open the website in a browser.
Put .htaccess in the directories with this content:
Order Deny, Allow
Deny From All
Related
I used File Manager and uploaded some txt and js files which is not part of site.
I denied access to site from refers except one.
Files can be read using browser.
I created folder and put these txt and js files,added htaccess and wrote next code
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://allowed refer site/ [NC]
RewriteRule .*\.(js|css)$ - [F]
However txt and js can be opened using browser.
<FilesMatch ~ "\.(txt|js)$">
Order allow,deny
Deny from all
</FilesMatch>
This code didn't effect,files are still can be read.
All files have chmod 600.How close access to these files to all refers except one?
How do I enable deny for a folder through htaccess with openlitespeed? I tried
RedirectMatch 403 ^/folder/?$
and
Deny from all
But it didn't work, I still access the folder even after restart openlitespeed
Could you please try following in your htaccess file. This will forbid any URL whose uri starts with folder.
RewriteEngine ON
RewriteRule ^folder - [F,L]
I have a Wordpress installation that uses permalinks, using mod_rewrite:
mysite.com/wp/post?id=3 becomes mysite.com/cats/furrycat
Now I want to prevent visitors to see posts in mysite.com/notes/. This folder does not exist, as it's just a wordpress category.
How can I block access to /notes/ in the root .htaccess?
Above the wordpress rules in the htaccess file in your document root, add:
RewriteRule ^notes/ - [L,F]
These need to be in the file before any of the wordpress rules. This will return a 403 Forbidden if a request is made that starts with /notes/
Im trying to deny access to a directory on my webserver but allow access to a certain URL like this. Deny access to www.mydomain.com/admin but allow access to www.mydomain.com/admin/webmailogin.
I need some help. Is it possible to do this with a .htaccess file?
You can add this rule in /admin/.htaccess:
RewriteEngine On
RewriteBase /admin/
RewriteRule ^$ - [F]
looking for some htaccess rewrite rules to block all access to a directory except for the server itself. It's a directory full of images and flash swf files. Yes I know it's sort of odd to not want direct access to a file its own directory, but to allow it to be seen by the user when referenced in other html outside the protected directory, but thats what i'm after. I have tried a few different methods as shown below:
# send them to index.php
Options +FollowSymlinks
RewriteEngine on
#RewriteRule ^(.*)$ ../User/ [NC]
#RewriteRule ^(.*)$ [R=301,L,NC]
# no one gets in here!
#deny from all
Options All -Indexes
<Limit GET POST PUT>
order deny,allow
deny from all
allow from 192.168.0.0/33
</Limit>
None of them seem to really do what I want. some of them block access to everything, including the server itself. Other redirect the request to another page, but because it keeps the same url, the links on the 'page' the user gets redirected to wont work.
If possible I would not even like to do a 404 warning, because while this disallows users access to the directory, the user will still know that that directory exists.
You can simply use this one line rule to do that:
RewriteRule ^mydir/ - [L,R=404,NC]
That way all the files under /mydir/ will generate 404 errors to your visitors but your server will still have access to those files.