I'm running into a rather annoying problem with my website.
I have a valid SSL certificate running on my domain but every time I try to manually access a certain page from my website it appears as non-ssl.
If I browse the pages starting from my homepage they all appear to be fine but if I go directly to a page the browser tells me that is not secured.
The odd thing is that this only happens when I type the link without "https/https" and www. Ex: "mywebsite.com/my-page".
If I'm entering "www" before the domain name or http/https it redirects to the secure version.
As a side note, I'm using WordPress as my CMS.
I would highly appreciate the help.
Thank you.
You can force https by adding the following to your htaccess file:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Related
I am trying to back up my Wordpress website and want to test my website locally, without a SSL certificate. I have installed MAMP but I am facing some problems to make it work.
When I start the apache server and go the localhost, my homepage does show up but the CSS doesn't load and I get a bunch of errors regarding a cache plugin.
But the biggest problem I am facing is that whenever I go to another page, my local website immediately tries to load a HTTPS page and goes to my live website (even when I specifically mention a HTTP link).
I have tried changing the .htacces file with the following code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
I have also changed the database homepage URL from https to http in wp_options but that only fixed the index page but not the other pages of my website.
My apologies if my question is still unclear, I'm kind of new to this so any help would be appreciated.
I am building a new site for a client. we preserved the old site in a wordpress multisitesolution. Now it's time to migrate into the new site. Problem is the old site is heavilly embedded in Google Search with many active links. So I need a way to catch and redirect each and every link that comes our way.
I can redirect old.sitename.com to new.sitename.com directly - this works fine. Problem is when I get direct links to posts or pages.
Som this is the syntax I need resolved
old.sitename.com/an-article-read-this --> new.sitename.com/an-article-read-this
I have tried several .htaccess commands, including a few wordpress addons. Even simple ssl with .htaccess redirect enabled.
RewriteRule ^old.*$\% https://hoppla.heiledeg.no/%{REQUEST_URI} [R=302,NC]
direct links keeps opening up in the old site. not the new one.
Yes I have refreshed cache. And even tested on "fresh" browsers.
Any ideas, tips, or even addons are very much appreciated.
for me this was the solution:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(old.)?olddomain.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]
When I try to access my Wordpress website directly or from google, the Home page URL automatically adding /?i=1 and sometimes /?i=2 to the URL in the address bar.
I think it's a very simple to solve it, but I tried many things and didn't work.
So I wonder how can I solve this to be only the URL without /?i=1 or /?i=2 ?
/?i=1 or /?i=2 protects your website from bots and is mostly applied by free hosting services and if you use any .htaccess code to remove it than all ? parameters will removed and redirect you to homepage
Try resetting your wordpress permalink from admin end. If you don't know how to do that check this video. As this is not normal behavior of wordpress you can also check your .htaccess file.
RewriteCond %{QUERY_STRING} ^(.*)i=[^&]+(.*)$ [NC]
RewriteRule ^(.*)$ /$1?%1%2 [R=301,L]
Add this in htaccess
My web site was working fine via http with postname option in Permalink. Recently I have activated https (i.e. ssl) for my website. After that only home page is working, sub pages are not working. For default Permalink settings https is working. I have purchased wild card ssl certificates from godaddy, they have given me 2crt files. One starts with b811adugdfdfd.crt and another is gd_bundle-g2-g1.crt. I have uploaded both certificates in apache server and a key file. am I doing any mistake?? Website landing page is working with https but not subpages. Thanks in advance. Is the issue with SSL, or .htaceess or permalinks?
If your using "apache" Add directory Permission in SSL configuration of apache
//Directory /var/www/html/demoproject/public //
AllowOverride All
Require all granted
//Directory//
Here are a few quick checks that might help (If your SSL settings are all fine):
Make sure that under General Settings Page you have changed the site address URLs from http://domainname.com to https://domainname.com.
Try to check pages by forcing it to SSL with the help of a plugin WordPress HTTPS.
Write this code in your .htaccess file
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
I copied a live woocommerce site back to the dev server. The live site uses https. So when I tried accessing it on the dev server, it redirected me to the live site. I figured the issue was the .htaccess file. I tried editing it, but the file is encrypted. So I just removed it all together. That stopped the redirecting, and I was able to access the front-end of the dev site. However when I try to access the wp-admin or wp-login.php I get a 404. I also noticed that the broswer changed from http to https. So there's something still trying to make the website run under https.
What I've tried:
I deactivated woocommerce plugin (by renaming it) but that didn't
help.
I also searched in the database for instances of https:// but I
could not find any that related to the website.
I also found and removed a cert.html file in the root which I think
it's related to the https certification, but I still can't access
the backend.
And last, I tried to add a new .htaccess file with the basic
wordpress permalinks in it, but that just gave 500 server errors.
Can anyone give some pointers where to look? Or what could be causing the browser to use https, instead of http.
It looks like you need to change your site URL to point to the right place. Since you can't log in (it'll redirect you to the wrong site URL), you need to change this in your wp-config.php file (see this link for more info):
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
After that, and hopefully with the default wordpress rules, you should be able to log in to the admin pages.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The above assumes that your wordpress site is at /.