===================================
PAID TRAINING ADS
Upcoming SEO / WordPress bootcamps
1-on-1 SEO Consulting and Coaching - Exclusive to those working as SEOs already - All info here - All info here
PAID TRAINING ADS
===================================
PAID TRAINING ADS
Upcoming SEO / WordPress bootcamps
1-on-1 SEO Consulting and Coaching - Exclusive to those working as SEOs already - All info here - All info here
PAID TRAINING ADS
===================================
To perform a 301 redirect from HTTP to HTTPS, you’ll need to configure your web server correctly. Below are the steps for common web servers:
1. Apache
Modify your .htaccess
file or the server configuration file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
- Ensure that the
mod_rewrite
module is enabled. - Place this code in your
.htaccess
file or within the<VirtualHost>
block of your Apache configuration.
2. Nginx
Modify your server block configuration file:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
return 301 https://$host$request_uri;
}
- Replace
yourdomain.com
andwww.yourdomain.com
with your domain name. - Restart Nginx with:
sudo systemctl restart nginx
3. IIS (Windows Server)
Use the IIS Manager to set up a redirect:
- Open IIS Manager.
- Select your site.
- Double-click HTTP Redirect.
- Check Redirect requests to this destination and enter your HTTPS URL.
- Check Redirect all requests to exact destination (rather than relative to destination).
- Set the redirection type to Permanent (301).
4. .htaccess Alternative (if not using mod_rewrite)
You can also use mod_alias
:
Redirect 301 / https://yourdomain.com/
Testing
- Test the redirect using your browser.
- You can also use online tools like Redirect Checker to verify that a 301 Moved Permanently status is returned.
If you’re hosting your website on Hostinger, you can set up a 301 redirect from HTTP to HTTPS by editing the .htaccess
file or using the Hostinger control panel.
5. Hostinger
Method 1: Edit .htaccess
File
- Log in to your Hostinger account.
- Navigate to File Manager (under Hosting → Manage → Files).
- Open the public_html directory and locate the
.htaccess
file.- If it doesn’t exist, create a new
.htaccess
file.
- If it doesn’t exist, create a new
- Add the following code to redirect HTTP to HTTPS:
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
- Save the changes.
Method 2: Use Hostinger Control Panel
- Log in to your Hostinger account.
- Go to Hosting → Manage for your website.
- Under the Advanced section, click on SSL/TLS.
- Ensure that an SSL certificate is installed and active.
- Enable the Force HTTPS option to automatically redirect HTTP to HTTPS.
Testing
- After making these changes, visit your website with
http://
and verify it redirects tohttps://
. - Use tools like Redirect Checker to confirm the status code is 301.