How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

July 14, 2020

redirect to https

Filed under: Linux — Tags: , , , , — admin @ 12:33 pm

I have more versions of redirect

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.matrafox.info/$1 [R,L]

Other version is

#non-www. http to www. https
RewriteCond %{ENV:HTTPS} !on
RewriteCond %{HTTP_HOST} ^(www.)?matrafox.info$
RewriteRule (.*) https://www.matrafox.info/$1 [R=301,L]

#non-www. https to www. https
RewriteCond %{ENV:HTTPS} on
RewriteCond %{HTTP_HOST} ^matrafox.info$
RewriteRule (.*) https://www.matrafox.info/$1 [R=301,L]

Other version is

RewriteEngine on

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^ https://www.example.com%{REQUEST_URI} [NC,L,R=301,NE]

Another one :

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

April 3, 2020

How to bypass htpasswd with specific ip

Filed under: Linux — Tags: , , — admin @ 2:15 pm

If you have code below and want to bypass your ip then you need to go to final form

AuthType Basic
AuthName “Private area”
AuthUserFile /var/www/html/dpath/.htpasswd
Require valid-user

Into this:

AuthType Basic
AuthName “Private area”
AuthUserFile /var/www/html/dpath/.htpasswd
Require valid-user

Order allow,deny
Allow from xxx.xxx.xxx.xxx
satisfy any

Powered by WordPress