corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » Force a Single Domain Name over Aliases


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author Force a Single Domain Name over Aliases
ed
Member

Registered: 10th Sep 03
User status: Offline
18th May 11 at 14:18   View User's Profile U2U Member Reply With Quote

This is something I really should know, but what's the best way to force one domain name over other alias domain names on a website. I've got three for my portfolio, but I'd like to 301 any requests made by the alias domain names to the main one.

I know I could do this with .htaccess, but for ease, does anyone know of a Wordpress plugin that could perhaps do it? Or, would I even be better off setting up the alias domains as redirects at the DNS level instead?
Sam
Moderator
Premium Member


Registered: 24th Dec 99
Location: West Midlands
User status: Offline
18th May 11 at 15:27   View User's Profile U2U Member Reply With Quote

I think on my domains I do this at registrar level (in my case, domainmonster.com).

You can also do this in cPanel IIRC.

[Edited on 18-05-2011 by Sam]
ENB
Member

Registered: 24th Apr 06
User status: Offline
19th May 11 at 11:56   View User's Profile U2U Member Reply With Quote

Wordpress plugin? Guessing you don't have access to the server?

What kind of server is it? Apache, IIS, light-httpd?

Presumably you're trying to say produce a 301 (permanent redirect) from subsite.com to mainsite.com?

I know it's a single line in Apache; which you can add in .htaccess (although it's slower than in the main httpd.conf, but you probably don't have much choice there).


Alternatively just set up a CNAME for subsite.com to point to mainsite.com.
ed
Member

Registered: 10th Sep 03
User status: Offline
19th May 11 at 12:24   View User's Profile U2U Member Reply With Quote

It's my server, I've got complete access to it - just wanted a plugin as it would be easier.

The .htaccess stuff seems to mess up my configuration as I'm running WP Super Cache.
Sam
Moderator
Premium Member


Registered: 24th Dec 99
Location: West Midlands
User status: Offline
19th May 11 at 13:16   View User's Profile U2U Member Reply With Quote

ed
Member

Registered: 10th Sep 03
User status: Offline
19th May 11 at 13:28   View User's Profile U2U Member Reply With Quote

I think the CNAME way would work best actually.

Forgot to say, it's Apache running on Ubuntu with all the usuals.
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
19th May 11 at 13:41   View Garage View User's Profile U2U Member Reply With Quote

I think CNAME will introduce duplicate content on both domains instead of re-writing the address to the preferred site.

I would use a PHP header() call for this, generally the most simple to set up.
ed
Member

Registered: 10th Sep 03
User status: Offline
19th May 11 at 14:46   View User's Profile U2U Member Reply With Quote

On Ian's advice, I've found a Wordpress plugin that forces www at the beginning of your URL's. I'll modify that to force my preferred domain name via a 301.

It's a pain you have to go down the custom plugin route, but I haven't found anything that'll do this for Wordpress - maybe I should make it good and publish it
Sam
Moderator
Premium Member


Registered: 24th Dec 99
Location: West Midlands
User status: Offline
19th May 11 at 15:25   View User's Profile U2U Member Reply With Quote

I've made about three WordPress plugins purely because there wasn't anything better suited to my requirements at the time, and I decided to release them on wordpress.org.

One of them has had over 12k downloads!

[/shouldhavechargedmoneyforthem]
ed
Member

Registered: 10th Sep 03
User status: Offline
19th May 11 at 16:09   View User's Profile U2U Member Reply With Quote

You seem to be able to stick donate buttons and adverts into the backend if you were really desperate!
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
19th May 11 at 16:21   View Garage View User's Profile U2U Member Reply With Quote

If I've got this right and you have three domains and they each point to different folders in the hosting, have your Wordpress install in one folder and in the others, make a file named index.php and put in:

<?php
header('Location: http://www.yourothersite.com/');
?>

You don't need plugin for that?
ENB
Member

Registered: 24th Apr 06
User status: Offline
20th May 11 at 13:40   View User's Profile U2U Member Reply With Quote

How does a CNAME duplicate content?

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
domain name WATSON Geek Day 12 1146
28th Aug 06 at 23:08
by WATSON
 
exchange server wookies Bart Geek Day 1 371
27th Jun 07 at 18:51
by Bram
 
1 host many websites... someone? Paul_J Geek Day 19 1209
8th Apr 08 at 19:15
by Dom
 
Web Hosts AdZ9 Geek Day 5 1361
7th May 08 at 22:25
by WATSON
 
Possible scammer? Generation Disputes 75 5719
20th Mar 10 at 10:45
by danh785
 

Corsa Sport » Message Board » Off Day » Geek Day » Force a Single Domain Name over Aliases 29 database queries in 0.0144269 seconds