Title: http to https &#8211; WP in Subfolder issues
Last modified: October 27, 2016

---

# http to https – WP in Subfolder issues

 *  Resolved [Niwa](https://wordpress.org/support/users/laniwa/)
 * (@laniwa)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/http-to-https-wp-in-subfolder-issues/)
 * I am pulling my hair out with this issue. We recently got an SSL certificate 
   and I am working on making sure all URLs with http redirect to https.
 * This is my current .htaccess code:
 *     ```
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteRule ^index\.php$ - [L]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
       </IfModule>
   
       # END WordPress
       ```
   
 * When I add this code however:
 *     ```
       <IfModule mod_rewrite.c>
       # BEGIN Force http to https
       RewriteEngine On
       RewriteCond %{HTTPS} !=on
       RewriteRule ^(.*) https://%{HTTP_HOST}/$1 [R=301,L]
       # END Force http to https
       </IfModule>
   
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteRule ^index\.php$ - [L]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
       </IfModule>
       # END WordPress
       ```
   
 * because my WordPress install is in a subfolder it breaks and tries to change 
   my urls to [http://www.mysite.com/subfolder/restoflink](http://www.mysite.com/subfolder/restoflink)
 * Is there any way to fix this??

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [Niwa](https://wordpress.org/support/users/laniwa/)
 * (@laniwa)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/http-to-https-wp-in-subfolder-issues/#post-8365052)
 * I can’t seem to edit my previous post, but currently I have changed my code to
   be this:
 *     ```
       RewriteEngine On
       RewriteCond %{HTTPS} off
       RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
   
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteRule ^index\.php$ - [L]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
       </IfModule>
       # END WordPress
       ```
   
 * Feel free to look at the site to see it in action: [http://www.grandcanyonplanning.com](http://www.grandcanyonplanning.com)
 * The WEIRD thing is that when there is a child page such as [http://grandcanyonplanning.com/services/estate-planning/](http://grandcanyonplanning.com/services/estate-planning/)
 * it redirects it to [https://grandcanyonplanning.com/gcpa/services/estate-planning/](https://grandcanyonplanning.com/gcpa/services/estate-planning/)
   which is not valid (notice the gcpa/ subfolder appears)
 * but [https://grandcanyonplanning.com/services/estate-planning/](https://grandcanyonplanning.com/services/estate-planning/)
   works just fine!
 * Weirdly enough this only affects those child pages and I am not sure HOW to fix
   this!
    -  This reply was modified 9 years, 7 months ago by [Niwa](https://wordpress.org/support/users/laniwa/).
 *  [James](https://wordpress.org/support/users/volcommky/)
 * (@volcommky)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/http-to-https-wp-in-subfolder-issues/#post-8365130)
 * I feel it has to do with your first RewriteRule, have you tried putting the URL
   in?
 * I would take a look at this page here: [Force HTTPS via HTAccess](http://www.inmotionhosting.com/support/website/ssl/how-to-force-https-using-the-htaccess-file)
 *  Thread Starter [Niwa](https://wordpress.org/support/users/laniwa/)
 * (@laniwa)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/http-to-https-wp-in-subfolder-issues/#post-8368441)
 * Thanks for your reply. I have changed the code to this following that page:
 *     ```
       RewriteEngine On 
       RewriteCond %{HTTP_HOST} ^grandcanyonplanning\.com [NC]
       RewriteCond %{SERVER_PORT} 80 
       RewriteRule ^(.*)$ https://grandcanyonplanning/$1 [R,L]
   
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteRule ^index\.php$ - [L]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
       </IfModule>
       # END WordPress
       ```
   
 * and I am still having the same issue.
 *  [James](https://wordpress.org/support/users/volcommky/)
 * (@volcommky)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/http-to-https-wp-in-subfolder-issues/#post-8368676)
 * Are you missing the .com on this line?
    [code]RewriteRule ^(.*)$ [https://grandcanyonplanning/$1](https://grandcanyonplanning/$1)[
   R,L][/code]
 * What is the site url and home url in your WP Options?
 *  Thread Starter [Niwa](https://wordpress.org/support/users/laniwa/)
 * (@laniwa)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/http-to-https-wp-in-subfolder-issues/#post-8368769)
 * RESOLVED
 * This is probably the dumbest solution but I figured out the issue. since I have
   the WordPress installation in a subfolder, I had some conflicting redirects in
   the .htaccess on the root directory.
 * I was not aware that the WordPress htaccess needed to be just in the folder and
   not on the root. Once I removed that from the root everything started working
   just fine.
    -  This reply was modified 9 years, 7 months ago by [Niwa](https://wordpress.org/support/users/laniwa/).

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘http to https – WP in Subfolder issues’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Niwa](https://wordpress.org/support/users/laniwa/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/http-to-https-wp-in-subfolder-issues/#post-8368769)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
