Tag Archive | "set redirection"

Tags:

Set redirection on Apache


You can create or modify .htaccess file under your domain mapping root to setup redirection.

To redirect www.domain.com to www.newdomain.com , add following line to .htaccess:
RedirectMatch 301 ^(.*)$ http://www.newdomain.com

To redirect domain.com to www.domain.com, add following lines to .htaccess:
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]

Redirect to sub folder with .htaccess file
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} domain.com
RewriteCond %{REQUEST_URI} !test/
RewriteRule ^(.*)$ test/$1 [L]

Set https redirect in .htaccess
RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://www.domain.com [R]

Share

Posted in Linux-Apache-PHPComments (0)