htaccess fun

Soldato
Joined
30 Jun 2003
Posts
2,807
Location
Berkshire
I'm working on a htaccess file and so far have the following:

What I'm needing to do is;
main domain to go to www. as a standard.
.co.uk domain to point to .com
getting Google webmaster errors of where the domain is trying to point to another address I'm forcing to go to index.php

Would someone mind taking a look see if this looks ok?

Code:
<Files "config.php">
Order Allow,Deny
Deny from All
</Files>

<Files "common.php">
Order Allow,Deny
Deny from All
</Files>

Redirect /viewtopic.php?f=15&t=2011 /index.php
Redirect /viewtopic.php?f=10&t=2047 /index.php
Redirect /viewtopic.php?f=15&t=988 /index.php
Redirect /viewtopic.php?f=17&t=2058 /index.php
Redirect /viewtopic.php?f=15&t=1063 /index.php
Redirect /viewtopic.php?f=17&t=848 /index.php
Redirect /viewtopic.php?f=15&t=1925 /index.php
Redirect /viewtopic.php?f=15&t=1750 /index.php
Redirect /viewtopic.php?f=10&t=1281 /index.php
Redirect /viewtopic.php?f=15&t=1808 /index.php
Redirect /viewtopic.php?f=15&t=1515 /index.php
Redirect /viewtopic.php?f=15&t=2024 /index.php
Redirect /viewtopic.php?f=15&t=1124 /index.php
Redirect /viewtopic.php?f=15&t=1268 /index.php
Redirect /viewtopic.php?f=15&t=721 /index.php
Redirect /viewtopic.php?f=15&t=646 /index.php
Redirect /viewtopic.php?f=15&t=1293 /index.php
Redirect /viewtopic.php?f=15&t=1682 /index.php
Redirect /viewtopic.php?f=17&t=1237 /index.php
Redirect /viewtopic.php?f=15&t=274 /index.php
Redirect /viewtopic.php?f=15&t=1278 /index.php
Redirect /viewtopic.php?f=15&t=837 /index.php
Redirect /viewtopic.php?f=15&t=1834 /index.php
Redirect /viewtopic.php?f=15&t=1254 /index.php
Redirect /viewtopic.php?f=15&t=1716 /index.php
Redirect /viewtopic.php?f=15&t=177 /index.php
Redirect /viewtopic.php?f=10&t=1398 /index.php
Redirect /viewtopic.php?f=15&t=1831 /index.php
Redirect /viewtopic.php?f=15&t=115 /index.php
Redirect /viewtopic.php?f=10&t=1860 /index.php
Redirect /viewtopic.php?f=19&t=794 /index.php
Redirect /viewtopic.php?f=15&t=276 /index.php
Redirect /viewtopic.php?f=15&t=1275 /index.php
Redirect /viewtopic.php?f=15&t=387 /index.php
Redirect /viewtopic.php?f=17&t=1248 /index.php

RewriteEngine on
RewriteCond %{HTTP_HOST} ^UKDOMAIN\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.UKDOMAIN\.co\.uk$
RewriteRule ^/?$ "http\:\/\/www\.MAINDOMAIN\.com" [R=301,L]

RewriteCond %{HTTP_HOST} ^MAINDOMAIN.com
RewriteRule (.*) http://www.MAINDOMAIN.com/$1 [R=301,L]

SetEnvIfNoCase User-Agent "^libwww-perl*" block_bad_bots
Deny from env=block_bad_bots
 
Commissario
Joined
23 Nov 2004
Posts
42,065
Location
Herts
Have you tried this -

Code:
RewriteEngine On 
RewriteBase /  
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.co\.uk$ [NC] 
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
 
Back
Top Bottom