Spaces in /source

This commit is contained in:
Oliver Davies 2015-06-06 17:21:24 +01:00
parent 45c8708a5f
commit 6e9dd34d0f
121 changed files with 1051 additions and 1051 deletions

View file

@ -3,23 +3,23 @@ title: Forward one domain to another using mod_rewrite and .htaccess
nav: blog
slug: forward-one-domain-another-using-modrewrite-and-htaccess
tags:
- .htaccess
- code
- drupal
- apache
- mod_rewrite
- .htaccess
- code
- drupal
- apache
- mod_rewrite
---
Within the mod_rewrite section of your .htaccess file, add the following lines:
RewriteCond %{HTTP_HOST} ^yoursite\.co\.uk$
RewriteRule (.*) http://yoursite.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^yoursite\.co\.uk$
RewriteRule (.*) http://yoursite.com/$1 [R=301,L]
This automatically forwards any users from http://yoursite.co.uk to http://yoursite.com. This can also be used to forward multiple domains:
RewriteCond %{HTTP_HOST} ^yoursite\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^yoursite\.info$ [OR]
RewriteCond %{HTTP_HOST} ^yoursite\.biz$ [OR]
RewriteCond %{HTTP_HOST} ^yoursite\.eu$
RewriteRule (.*) http://yoursite.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^yoursite\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^yoursite\.info$ [OR]
RewriteCond %{HTTP_HOST} ^yoursite\.biz$ [OR]
RewriteCond %{HTTP_HOST} ^yoursite\.eu$
RewriteRule (.*) http://yoursite.com/$1 [R=301,L]
If any of the RewriteCond conditions apply, then the RewriteRule is executed.