logo
down
shadow

.htaccess authentication with wordpress


.htaccess authentication with wordpress

By : Connor E Howe
Date : November 19 2020, 03:59 PM
Does that help OK, I have an area on my wordpress site, home/gallery/test and I want to restrict access to it using .htaccess. Setting up authentication for a directory using .htaccess is pretty straightforward. But my problem in wordpress is that home/gallery/test doesn't actually exist as a directory anywhere because I'm using pretty URLs. , There is a solution using mod_setenvif
code :
SetEnvIfNoCase REQUEST_URI "^/home/gallery/test" PROTECTED

AuthType Basic
AuthName "Test protection"
AuthUserFile /path/to/passwords_file
Require valid-user
Satisfy any
Order allow,deny
Allow from all
Deny from env=PROTECTED
SetEnvIfNoCase REQUEST_URI "^/home/gallery/test" PROTECTED

AuthType Basic
AuthName "Forbidden"
AuthUserFile /home/xxxxx/.htpasswd
Require valid-user
Satisfy any
Order allow,deny
Allow from all
Deny from env=PROTECTED

# BEGIN WordPress
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  RewriteRule ^failed_auth\.html$ - [L]

  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ index.php [L]
</IfModule>
# END WordPress


Share : facebook icon twitter icon
Htaccess - Http Authentication - Possible to possible to catch GET and apply authentication then redirect? Have example

Htaccess - Http Authentication - Possible to possible to catch GET and apply authentication then redirect? Have example


By : Pierre Thef
Date : March 29 2020, 07:55 AM
like below fixes the issue
it is possible to actually catch a GET, apply http authentication then redirect the user to a page that is held out of the http:// root?
I want to change URL for specific page for my wordpress site through htaccess or using wordpress function

I want to change URL for specific page for my wordpress site through htaccess or using wordpress function


By : sagar
Date : March 29 2020, 07:55 AM
To fix this issue I have URL like this http://www.shreyinnovations.com/edudemo/app-detail/?app-detail=A-Level%20Revision which I need to replace like below http://www.shreyinnovations.com/edudemo/app/A-Level%20Revision , Try adding this code before the WP rule-set:
code :
RewriteEngine On
RewriteCond %{REQUEST_URI}  ^/edudemo/app-detail [NC]
RewriteCond %{QUERY_STRING}  app-detail=([^&/]+) [NC]
RewriteRule .*               /edudemo/app/%1?    [R=301,L]              

# BEGIN WordPress
htaccess Server-side WEBP detection in conjunction with WordPress htaccess rules

htaccess Server-side WEBP detection in conjunction with WordPress htaccess rules


By : user2364564
Date : March 29 2020, 07:55 AM
Any of those help I have my htaccess file setup like so: , This worked for me,
code :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /DPA/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /DPA/index.php [L]
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /DPA/
  # check if browser accepts webp
  RewriteCond %{HTTP_ACCEPT} image/webp 

  # check if file is jpg or png
  RewriteCond %{REQUEST_FILENAME} (.*)\.(jpe?g|png)$

  # check if corresponding webp file exists image.png -> image.webp
  RewriteCond %1\.webp -f

  # serve up webp instead
  RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]

</IfModule>

<IfModule mod_headers.c>
  Header append Vary Accept env=REDIRECT_accept
</IfModule>

AddType image/webp .webp
integrating .htaccess code to redirect all subdomains from http to https into Wordpress .htaccess

integrating .htaccess code to redirect all subdomains from http to https into Wordpress .htaccess


By : Fawaz Islam Ad-da'wa
Date : March 29 2020, 07:55 AM
like below fixes the issue Your regex has an extra DOT after example which will expect to match a single character afterwards here:
code :
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^((?!www\.)[^.]+)\.example.\.com\.au$
RewriteRule ^ https://%1.example.com.au%{REQUEST_URI} [NE,L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^((?!www\.)[^.]+)\.example\.com\.au$ [NC]
RewriteRule ^ https://%1.example.com.au%{REQUEST_URI} [NE,L,R]
My WordPress got hacked through an infected .htaccess file and here's its content, what does this htaccess do?

My WordPress got hacked through an infected .htaccess file and here's its content, what does this htaccess do?


By : Adam Fenn
Date : March 29 2020, 07:55 AM
this one helps. After scanning a client's server for malware, I found that an .htaccess file was infected with the following malware: ,
code :
RewriteRule ^(denaturization)([0-9]+)-(.*)--a([0-9]+)\/(.*)$ ?denaturization$2=$4&%{QUERY_STRING}[L]
/denaturization123-foo--a456/bar?baz=abc
/?denaturization123=456&baz=abc[L]
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org