Skip to:
Content
Pages
Categories
Search
Top
Bottom

Urgent: Turning my site into https is not working

  • @amalsh

    Participant

    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)
  • @henrywright

    Moderator

    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.

    @amalsh

    Participant

    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

    @henrywright

    Moderator

    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?

    @amalsh

    Participant

    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>

    @henrywright

    Moderator

    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

    @amalsh

    Participant

    Like where? What could it be for example?

    @henrywright

    Moderator

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

    @amalsh

    Participant

    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

    Participant

    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>

    @amalsh

    Participant

    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

    Participant

    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

    @amalsh

    Participant

    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

    @henrywright

    Moderator

    @amalsh

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

    @amalsh

    Participant

    @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?

    @henrywright

    Moderator

    What’s the entire contents of your .htaccess?

    @amalsh

    Participant

    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>

    @henrywright

    Moderator

    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.

    @amalsh

    Participant

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

    @henrywright

    Moderator

    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]

    @henrywright

    Moderator

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

    @amalsh

    Participant

    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

    @amalsh

    Participant

    Any suggestion?

    @amalsh

    Participant

    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