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]
Related
I'm kinda new to htaccess, I'm trying to block everything but index.php, the folder public and the files it contain. I have googled around and got this so far. Its kinda working but it looks like the webserver dont have access to the files either. It opens index.php but no css,js or php files are included. I can also go to domain.com/folder/ and get to the index page but its empty i would want it to redirect to index.php if possible. And i also have no clue about how to open the public folder while everything else above is set.
AuthType Basic
order allow,deny
<Files ~ "^(index\.php|)$">
Allow from all
</Files>
<Files .htaccess>
Order Allow,Deny
Deny from all
</Files>
DirectoryIndex index.php
Replace all of your code with this mod_rewrite rule in your site root .htaccess:
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(?:index\.php$|public/|.+\.(?:jpe?g|gif|png|ico|tiff|css|js)$) [NC]
RewriteRule . - [F]
This rule will block everything except public/ folder, index.php or any other file ending with .css, .js, images etc.
I have a htaccess file with following code when trying to block an IP:
DirectoryIndex index.php index.html
ErrorDocument 404 /errors.php
Order Allow,Deny
Deny from 188.143.232.
Allow from all
Blocking my own IP works when browsing www.example.com, but it does not block for anything else (like www.example.com/index.php or www.example.com/home, ....). The htaccess is located in the same directory as index.php (httpdocs folder).
How can I get it to work?
You can also use a mod-rewrite based ip-blocking to block unwanted ip(s) :
RewriteEngine on
#--if client ip==188.143.232
RewriteCond %{REMOTE_ADDR} ^188\.143\.232
#--forbid the request
RewriteRule ^ - [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]
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