BIP KB Tag: Redirect
How To Redirect HTTP Traffic To HTTPS Using An .htaccess File
The below code, when added to a .htaccess file, will automatically redirect any traffic destined for http: to https:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
...
By lee, January 24, 2015
How To Redirect Non-www Traffic To www Using mod_rewrite
This is an example using the mod_rewrite Apache module to force all traffic to your site to www.yourdomain.com .
This can be useful in an SSL context, as well as for SEO purposes. Create a .htaccess file in your web root (public_html for cPanel servers) and add the following lines:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^your-domain.com
RewriteRule (.*) http://www.your-domain.com/$1 [R=301,L]
...
By tasia, January 24, 2015
How To Redirect Apache NON-SSL to SSL
If you want to force your site visitors to view your web site over an SSL connection and you have your SSL vhost already properly created in Apache, you can add the following to your .htaccess file in the root of your site:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}...
By chris, March 17, 2015
How To Redirect or block traffic based on country geographical location using Apache mod_geoip
In this tutorial you will learn how to block or redirect web traffic based on the visitor's country (geographical location) using Apache's geoip mod.
1. Apache mod_geoip installation
Assuming that you already have a Apache webserver installed and running we will start by the installing mod_geoip:
UBUNTU/DEBIAN
# apt-get install libapache2-mod-geoip
CENTOS/REDHAT/FEDORA ( epel enabled only )
# yum install mod_geoip.x...
By lee, June 24, 2015
How To Redirect HTTP to HTTPS using an .htaccess file
The below code when added to an .htaccess file will automatically Redirect HTTP traffic to https:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
...
By salem, May 20, 2016