[SOLVED] Redirect http:// http://www. and https:// all to one https://www

Need help regarding redirect as in title i want to redirect all http:// http://www. and https:// all to one https://www. . Godaddy give this code

BEGIN GD-SSL

Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_USER_AGENT} ^(.+)$ RewriteCond %{SERVER_NAME} ^coolexample\.com$ [OR] RewriteCond %{SERVER_NAME} ^www\.coolexample\.com$ RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] Header add Strict-Transport-Security "max-age=300" # END GD-SSL

BEGIN WordPress

RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress

for .htaccess file but it redirect http:// to https:// and http://www to https://www

2 Likes

Try CloudFlare Page Rules

1 Like

If it is a wordpress then you can use this plugin to redirect to SSL

Or you can edit your .htaccess to redirect to ssl

RewriteEngine On

RewriteCond %{HTTPS} off

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

2 Likes

This plugin is very good and i’m using it on one of my website hosted on google cloud but for another website i’m using goDaddy hosting and their ssl managing service is very bad i tried many codes nothing work and there are already many plugins install if possible i don’t want to use more plugins btw thanks

What is the error you are getting .

PM me if possible

You can use .htaccess rules or WordPress function Function Reference/wp redirect to set redirect rules.


Setting Up 301 Redirects in WordPress using .htaccess

Using the web server configuration file .htaccess, WordPress users can set up 301 redirects that are fast.

Please keep in mind that a small mistake in your .htaccess code can make your WordPress site inaccessible, and it may start showing Internal Server Error.

That’s why it is important that you backup your .htaccess file before making any changes.

To edit your .htaccess file, you will need to connect to your website using an FTP client. The .htaccess file resides in your WordPress site’s root directory.

If you can’t see your .htaccess file there, then you need to force your FTP client to show hidden files. (See why you can’t find .htaccess file on your WordPress site.)

You can edit .htaccess file in any plain text editor like Notepad.

Here is a simple redirect, where we are trying to send a user visiting an old post to a new post.

RewriteEngine On
Redirect 301 /a-very-old-post/ http://yoursite.com/a-very-new-post/

You can add the code above preferably at the end of your .htaccess file.


2 Likes