Everyone,
i have my ssl certificate installed on https://www.copierextravaganza.com but my actual domain the website runs is on https://copierextravaganza.com ... to make my ssl visible i used 301 redirect by modifying htaccess ... after implementing the code, whenever i open the website it does not load up and shows error website has too many redirects ..
is there some error in the htaccess code below ?
my website is on wordpress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^copierextravaganza\.com$ [NC]
RewriteRule ^$ https://www.copierextravaganza.com/ [R=301,L]
RewriteRule ^author/(privacy)/?$ /$1 [R=301,L,NC]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Please advice thanks
Abhishek
I think if the site_url option (see settings/general in the wordpress dashboard) is set to http://domain.com and you access it from http://www.domain.com then it will 301 redirect you to http://domain.com. You're effectively forcing the site to redirect you back to http://www.domain.com, causing a loop. The best thing to do would be to either change your site url to http://www.domain.com, or get SSL certification for the domain without the www
Related
Problem
Using .htaccess to force HTTPs on my Wordpress site does not work
Tried solution
On my Wordpress site I have the following .htaccess code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
But to force using HTTPs I'am trying to replace it with this code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} mydomain\.dk [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mydomain.dk/$1 [R,L]
</IfModule>
Result
The website is no longer working (here is the website response):
This page isn’t working
www.mydomain.dk redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS
Questions
Why can't I force using HTTPs on my Wordpress website?
What can I do to make it work?
Best regards, Henning
Before trying the surggested solutions - I tried to change the URL in the Wordpress settings to HTTPS and now it works.
Thanks for taking the time to answer my question, I was just about to try the Really Simple SSL plugin.
If your web server is running Apache, you can redirect all HTTP traffic to HTTPS by returning to the default .htaccess configuration and than adding the following code to your .htaccess file.
This is also the recommended method for redirecting WordPress to Apache:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
However, probably the easiest way to implement HTTPS on your WordPress site would be to install the following plugin:
https://wordpress.org/plugins/really-simple-ssl/
Need a little help, I have a website and I have activate SSL to that,
Everything is on SSL except the sitemap page, it’s automatically redirecting to http:// mode rather than https mode.I have to type https manually to view sitemap page in https mode.
For this I am having search console error.Search console can read sitemap but it’s showing http error.How to redirect http to https automatically.Here’s my .htaccess code though.
<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
I am using yoast SEO.
You have to enable HTTPS. I thought Yoast would do that for you. It could be browser cache?
Try adding this to the top of your .htaccess file:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
A site new to me as of today is broken. It is a wordpress site that the client tried to convert to HTTPS by themselves and it broke. They then tried to undo the work and go back to non-s version.
this has worked with one exception. The site is trying to redirect scripts to the SSL version.
For example trying to access this:
http://example.com/wp-includes/js/jquery/jquery.js?ver=1.12.4
is redirecting to this:
https://www.example.com/js/jquery/jquery.js?ver=1.12.4
(not the real domain.. obv)
Can anybody advise on how to fully revert?
If it helps, the Security Cert was purchase through Namecheap. The hosting is GoDaddy, and they attempted to follow the instructions here: https://designmodo.com/wordpress-https/
** edit **
SSL has been reinstalled, and it doesn't appear to be the problem. Something is redirecting scripts, removing the "wp-includes" from the url
the htaccess
# BEGIN GD-SSL
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^example\.com$ [OR]
RewriteCond %{SERVER_NAME} ^www\.example\.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security "max-age=300"
</IfModule>
# END GD-SSL
# 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
Wordpress save a lot of content and settings in the database, try installing this plugin Velvet Blues Update URLs to find-replace in your database the old values https://example.com with http://example.com some plugins save their own cache, so you probably need to go into a file browser and delete their cache folders.
If that doesn't work double check that your .htaccess is not redirecting your http traffic to https.
I did some changes to my .htaccess file before installing a nice pluging to handle all http to https redirects and now I see it has 2 redirects before my home pages gets 200 status code. How do i remove 1 redirect caused by my .htaccess?
# BEGIN HTTPS Redirection Plugin
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# END HTTPS Redirection Plugin
# 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
I use Easy HTTPS (SSL) Redirection for my WP site.
I use https://httpstatus.io/ to check # of redirects and its status.
I have had the same problem in Wordpress and what it has worked for me is:
Install plugin Better Search Replace and change all the instances in the database from http:// to https://
Delete all the code in the .htaccess file related to mod_rewrite
Insert in the file functions.php of the theme the following code:
remove_filter('template_redirect','redirect_canonical');
Purge all caches
And as result I have obtained this:
Results
I received my certificate through Comodo and installed it through cPanel. It shows up on my browser when I go to the url, but I am unable to get the content of the webpage as I get a 302 redirect loop. I changed my htaccess file to
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.org/$1 [R,L]
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
within the wordpress admin editor, I changed my website from http to https.
Could you please modifies the https rule in .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
and also go to wordpress setting and chnage the domain redirection
http://example.com to https://example.com
Try the following code to redirect from http to https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.org/$1 [R,L]
create a new .htaccess file with the default rules of wordpress >>
In Cpanel redirects options , configure a permanent redirect from http to https with or without www >> you may also need to use a wordpress plugin that apply the proper ssl security to the images and the posts
and then check.