Urgent: Turning my site into https is not working
-
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
-
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:
- Turn on the rewriting engine
- Check if the request isn’t HTTPS and
- 301 redirect whatever the current page to the same page but HTTPS.
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
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?
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>
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
Like where? What could it be for example?
You should check your error logs to see if anything is written. Also, what status code are you getting?
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/
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>
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>
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.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 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?
What’s the entire contents of your .htaccess?
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>
You are ensuring /socialnetwork/ is prepended to relative paths in the line
RewriteBase /socialnetwork/
. Why are you manually doing it again in lineRewriteRule . /socialnetwork/index.php [L]
?Try removing just the socialnetwork part from the last line.
If I remove the socialnetwork part, all pages are redirected to the homepage!
Try moving
RewriteBase /socialnetwork/
to the top, directly underneathRewriteEngine 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]
Also, where exactly do you have this .htaccess file? In what directory?
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
Any suggestion?
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.
- The topic ‘Urgent: Turning my site into https is not working’ is closed to new replies.