Redirect to HTTP non-www to HTTPS www htaccess

Try it like this: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301] The only real difference here is that first we redirect from non-WWW to WWW then we check for HTTPS and redirect it. If it does not work, try this one: RewriteEngine On RewriteCond %{HTTP_HOST} … Read more

.htaccess URL redirect

You could utilise mod_rewrite. RewriteEngine On RewriteRule ^blog/index\.php/weblog/rss_2\.0/$ /feed/ [R=302] That should forward the URL to /feed/ on the same domain as the request came in on. Once you’re happy it’s working you can change the 302 to 301.

Ban IPs from text file using htaccess [closed]

You can try using variations of RewriteMap. You’ll need access to the server/vhost config because that directive only works there. You can then use the map inside htaccess files. Say your blacklist.txt file looks like this: 111.222.33.44 deny 55.66.77.88 deny 192.168.0.1 allow You can define the map like so: RewriteEngine On RewriteMap access txt:/path/to/blacklist.txt Then … Read more

.htaccess to restrict access to folder

If you don’t have the option of actually moving the “includes” folder outside of the Document Root area, and using the include_path (i.e. you can’t get to it from web), then enter deny from all in a .htaccess directory in that directory. However, alternative is to use a DEFINES directive to only allow access to … Read more