Sebastian Mogilowski's Blog

Just another blog about administration, linux and other stuff

Force https to http redirect except for WordPress /wp-admin directory

First move all requests that are not wp-admin requests from https to http.

Than i want to exclude all of WordPress admin from the https to http redirect, to keep WordPress admin working over https, so this is the result:

RewriteEngine On

RewriteBase /
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/?(wp-admin/|wp-login\.php)
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/?(wp-admin/|wp-login\.php)
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

,

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

eMail-Benachrichtigung bei weiteren Kommentaren.
Auch möglich: Abo ohne Kommentar.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre, wie deine Kommentardaten verarbeitet werden.