How to Redirect www URL to non-www and non-www URL to www with Nginx

This tutorial will show you how to redirect a www URL to non-www, e.g. www.example.com to example.com, with Nginx. We will also show you how to redirect in the other direction, from a non-www URL to www. Configure DNS Records In order to set up the desired redirect, www.example.com to example.com or vice versa, you must have an A record for each name. Option 1: Redirect www to non-www Option 2: Redirect non-www to www

October 12, 2019 · 1 min · 75 words · Akhil Jalagam

How to Redirect HTTP to HTTPS in Nginx

All login credentials transferred over plain HTTP can easily be sniffed by a MITM attacker, but it is not enough to encrypt the login forms. If you are visiting plain HTTP pages while logged in, your session can be hijacked, and not even two-factor authentication will protect you. To protect all info sent between your visitors – which includes you – and your web server, we will redirect all requests that are coming over plain HTTP to the HTTPS equivalent....

October 12, 2019 · 1 min · 112 words · Akhil Jalagam

How to Redirect HTTP to HTTPS in apache

Install modules Enable modules Method 1 using rewrite module RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] </VirtualHost> Method 2 using redirect method Redirect permanent / https://www.yourdomain.com/ </VirtualHost>

September 4, 2019 · 1 min · 29 words · Akhil Jalagam

How To Redirect www to non-www OR non-www to www with Apache

1. Configure DNS Records In order to set up the desired redirect, www.example.com to example.com or vice versa, you must have an A record for each name. 2. Enable the mod_rewrite module 3.1 Update site.conf or .htaccess file ( www to non-www) 3.2 Update site.conf or .htaccess file ( non-www to www) Example ServerName example.net Documentroot /var/www/html/ RewriteEngine on RewriteCond %{HTTP_HOST} ^www.yoursite.com RewriteRule (.*) http://yoursite.com/$1 [R=301,L] </VirtualHost>

August 31, 2019 · 1 min · 67 words · Akhil Jalagam