Skip to:
Content
Pages
Categories
Search
Top
Bottom

Urgent: Turning my site into https is not working


  • Hope
    Participant

    @amalsh

    Hi dears,

    I’m trying to turn my site to https by following the steps mentioned in this URL: https://css-tricks.com/moving-to-https-on-wordpress/ (9. Start forcing HTTPS everywhere) which are the same in many references. But unfortunately it works only on the homepage while all other pages don’t open (cannot open page… error occurs)! Have I missed something? knowing that I have SSL certificate on my server…

    Thanks
    Hope

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

  • Henry Wright
    Moderator

    @henrywright

    Hey @amalsh

    Which server are you using? If Apache, do you have .htaccess enabled? If so then how about using mod_rewrite?

    RewriteEngine on
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

    This will do this following:

    1. Turn on the rewriting engine
    2. Check if the request isn’t HTTPS and
    3. 301 redirect whatever the current page to the same page but HTTPS.

    Hope
    Participant

    @amalsh

    Hi @henrywright,

    Thanks for replying… Actually I’ve already done this and modified the site URL as mentioned in the guide but got the issue mentioned previously! Have I missed something?

    Thanks


    Henry Wright
    Moderator

    @henrywright

    Sorry, I didn’t read the article in full. I just noticed item 9 describes how to do the .htaccess part.

    Do you have anything else in .htaccess that may be conflicting?


    Hope
    Participant

    @amalsh

    Don’t worry… I have the basic .htaccess file:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /socialnetwork/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /socialnetwork/index.php [L]
    </IfModule>

    Henry Wright
    Moderator

    @henrywright

    That looks pretty standard to me. everything is sent to index.php as expected so I doubt the problem is with your .htaccess directives. The problem must be elsewhere


    Hope
    Participant

    @amalsh

    Like where? What could it be for example?


    Henry Wright
    Moderator

    @henrywright

    You should check your error logs to see if anything is written. Also, what status code are you getting?


    Hope
    Participant

    @amalsh

    I get this error when trying to open any page except homepage (example the login page):

    Not Found
    The requested URL /socialnetwork/wp_login/ was not found on this server.

    In the error log I got for example:
    [Wed May 20 00:22:24 2015] [error] [client ............] File does not exist: /var/www/favicon.ico, referer: https://......./socialnetwork/wp_login/


    danbp
    Moderator

    @danbp

    basic htaccess for a single install look’s like this:
    (assuming your root site is hxxp://your-site.com)

    # CONFIG SINGLE
    #<IfModule mod_rewrite.c>
    #RewriteEngine On
    #RewriteBase /
    #RewriteRule ^index\.php$ - [L]
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule . /index.php [L]
    #</IfModule>

    Hope
    Participant

    @amalsh

    Don’t I need to mention the site folder? like if my website is http://your-site.com/wordpress, I put:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wordpress/index.php [L]
    </IfModule>

    danbp
    Moderator

    @danbp

    Depends where wp is installed ! Usually at site root.
    See your WP settings (settings > general) if unsure.
    Remember also that BuddyPress does not work on installations where you give WordPress its own directory.

    Getting Started


    Hope
    Participant

    @amalsh

    Yes I gave WordPress its own directory under the site root and Buddypress is working fine! My website is working fine from about a year an a half, the problem is in turning it into HTTPS which is not working :S


    Henry Wright
    Moderator

    @henrywright

    @amalsh

    None of what you have here relates to redirecting HTTP to HTTPS. I’m assuming you know that?


    Hope
    Participant

    @amalsh

    @henrywright sure, turning a wordpress website into https requires as mentioned in most of the references:
    1- adding:

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

    to the htaccess file
    2- Modifying site and wordpress addresses (in the general settings).

    Talking about the htaccess file led us to what we were talking above (to assure that the basic htaccess file is right)…

    So again, have I missed something?


    Henry Wright
    Moderator

    @henrywright

    What’s the entire contents of your .htaccess?


    Hope
    Participant

    @amalsh

    The entire content is as follows:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    RewriteBase /socialnetwork/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /socialnetwork/index.php [L]
    </IfModule>

    Henry Wright
    Moderator

    @henrywright

    You are ensuring /socialnetwork/ is prepended to relative paths in the line RewriteBase /socialnetwork/. Why are you manually doing it again in line RewriteRule . /socialnetwork/index.php [L]?

    Try removing just the socialnetwork part from the last line.


    Hope
    Participant

    @amalsh

    If I remove the socialnetwork part, all pages are redirected to the homepage!


    Henry Wright
    Moderator

    @henrywright

    Try moving RewriteBase /socialnetwork/ to the top, directly underneath RewriteEngine On

    For example:

    RewriteEngine On
    RewriteBase /socialnetwork/
    
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
    RewriteRule ^index\.php$ - [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    Henry Wright
    Moderator

    @henrywright

    Also, where exactly do you have this .htaccess file? In what directory?


    Hope
    Participant

    @amalsh

    I’ve already tried to change the location of the https lines in the htaccess file but nothing changed :S the file is in the wordpress directory i.e in the socialnetwork directory in my case.

    Thanks


    Hope
    Participant

    @amalsh

    Any suggestion?


    Hope
    Participant

    @amalsh

    If any one faces the same issue, the problem is not in the .htaccess file (it’s correct)! The problem is in the apache configuration file, assure that you put AllowOverride all in the virtual host directive.

Viewing 23 replies - 1 through 23 (of 23 total)
  • The topic ‘Urgent: Turning my site into https is not working’ is closed to new replies.
Skip to toolbar