How to terminate redirecting to https for my WordPress (sub directory)?

Posted October 27, 2018 612 views
WordPressUbuntu 16.04

My main WordPress is working good.

But its sub directory (WordPress) is not working.

It is redirecting to https.

I need to have working sub directory WordPress.

But it is redirecting to and not working.

Please help this.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hello, @sungeeservice

Could you please let me know if you’re using Nginx or Apache? In Apache you need to set Allow Override to All under the secure virtual host at port 443.

The following code in the htaccess file allows to force https across the whole website except a specific folder:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !/webservice     [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}  [R=301,L]

So any request to http would go to https. However you still need to explicitly change requests to https on your specified folder to redirect to http, so added the following code after the above:

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} /webservice      [NC]
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Hope this helps