Question

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

Posted October 27, 2018 373 views
WordPressUbuntu 16.04

My main WordPress is working good. http://sungeetheme.com

But its sub directory (WordPress) is not working.

It is redirecting to https.

I need to have working sub directory WordPress. http://sungeetheme.com/frexy_wp

But it is redirecting to https://sungeetheme.com/frexy_wp and not working.
http://prntscr.com/lb0b1f

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.

×
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

Regards,
Alex

Submit an Answer