Please wait while we load your page...
 

Announcements

HTACCESS Magic :: Page 7







Results 13 to 14 of 16

Redirect IP To Domain

The following Rewrites will redirect users who access site IP to site domain:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^123\.456\.789\.012
RewriteRule (.*)$ http://www.yourdomain.com/$1 [R=301,L]


Note 1: To use Rewrite, (1) site must be hosted on an Apache web server, (2) mod_rewrite module must be compiled into Apache, and (3) mod_rewrite must be enabled for your domain.
Note 2: Replace 123\.456\.789\.012 with your server IP address, and yourdomain.com with your domain name.
Note 3: R=301 is a permanent redirect, and is the most efficient and "Search Engine Friendly" method for redirection. Alternatively, you can use R=302 for temporary redirect if the redirect is not permanent.

Last Revised: 2015-07-04

Redirect Subdomain To Subdirectory

The following Rewrites will redirect subdomain traffic to a subdirectory:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.yourdomain\.com(:80)?$
RewriteCond %{DOCUMENT_ROOT}/%1/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/%1/$1 -d
RewriteRule (.*) /%1/$1 [L]


Note 1: Your subdirectory needs to be named the same as your subdomain. For example, subdomain.yourdomain.com would be redirected to yourdomain.com/subdomain/
Note 2: To use Rewrite, (1) site must be hosted on an Apache web server, (2) mod_rewrite module must be compiled into Apache, and (3) mod_rewrite must be enabled for your domain.
Note 3: R=301 is a permanent redirect, and is the most efficient and "Search Engine Friendly" method for redirection. Alternatively, you can use R=302 for temporary redirect if the redirect is not permanent.

Last Revised: 2015-07-03



Live Chat Not Available