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

February 5, 2019

How to exclude subfolder from password protection with .htaccess

Filed under: Linux — Tags: , , , , , — admin @ 1:38 pm

So if you want to protect a website with .htaccess and .htpasswd basically you will use

AuthType Basic
AuthName “Password Protected Area”
AuthUserFile /path/.htpasswd
Require valid-user

If you want a subdirectory to be excluded from auth like .well-known , for lets encrypt then a easy way it to create a .htaccess on .well-known directory and place in it

Satisfy any

Other version is to insert into vhosts

<Location /.well-known>
    Require all granted
</Location>

Another one is to add

SetEnvIf Request_URI “path/to/excluded/directory/” allow
SetEnvIf Request_URI “path/to/excluded/file” allow
Order allow,deny
Allow from env=allow
Satisfy any

And anothe one is to add

Require expr %{REQUEST_URI} =~ m#^/.well-known/acme-challenge/#

Before require valid user

January 16, 2019

How to deny execution of php on some directory

Filed under: Linux — Tags: , , , — admin @ 1:12 pm
Just add this on your .htaccess in that directory and php will not be executed.
# Kill PHP Execution
<Files ~ "\.ph(?:p[345]?|t|tml)$">
deny from all
</Files>

September 13, 2018

Bypass Authentication Or Access Requirements .htpasswd

Filed under: Linux — Tags: , , , , — admin @ 9:43 am

Well if you are using letsencrypt with a password protected website is hard to renew the ssl because you need to bypass that .

If you have access to httpd conf the easy solution is to add this

 

<Directory /var/www/path/.well-known/>
  Order allow,deny
  Allow from all
  Satisfy any
</Directory>

Then restart the apache/httpd.


November 2, 2017

Modify .htaccess on wordpress site to move to new domain

Filed under: Linux — Tags: , , , — admin @ 10:25 am

In order to move the wordpress to new domain you must modify the .htaccess with

 

#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.newdomain.com$1 [R=301,L]

Powered by WordPress