Helping the World with KnowledgePosts RSS Comments RSS

Archive for April, 2008

Pointing Add-on Domain to Existing Domain’s folder

In this article, I am attempting to point an “add-on” domain (aka alternate domain) to an existing domain’s folder. This is, I believe, somewhat like what blogger.com does with its premium features, where users can use their own domain to overwrite the blogspot.com subdomain.

—-

Update: 2:30 PM 5/9/2008

A simpler method for doing this with (gs) account is discovered.

Please refer to Pointing Add-on Domain to Existing Domain’s folder 2

–End of Update–

This is what I am attempting to do:
newdomain.com to show olddomain.com/folder and
newdomain.com/whatever-that-follows to show olddomain.com/folder/whatever-that-follows

I am using mediatemple.com Grid Service (gs) as my host in this experiment, however those using Cpanel or other platforms should be able to do this as well, as long as you can add add-on domains.

Using mediatemple (gs) add-on domains must be configured manually using SSH after adding it as an alternate domain in their interface.

The following is for Mediatemple (gs) only, other platforms are most probably done differently as the folder structures are different. You can skip Step (1) if you are using Cpanel, you just have to add newdomain.com as a add-on domain to olddomain.com.

Step (1) Delete the existing domain’s folder. Although this can be done manually using FTP or the file manager, the SSH command is:

cd domainsrm -rdf newdomain.com

Then, create the sym link:

ln -s olddomain.com newdomain.com

Step (2) Now add a .htaccess file to olddomain.com’s web root directory (html folder of (gs) and public_html folder for Cpanel)

The contents of the .htaccess file (”thefolder” is the folder within olddomain.com’s root folder that I want newdomain.com to show):

Options +FollowSymlinks

RewriteEngine On

RewriteBase /#Fix trailing slash issue

RewriteCond %{REQUEST_URI} ^/[^.]+[^/]$

RewriteRule ^(.+)$ http://%{HTTP_HOST}/$1/ [R=301,L]

#Send to the correct web site directory

RewriteCond %{HTTP_HOST} newdomain.com

RewriteCond %{REQUEST_URI} !thefolder/

RewriteRule ^(.*)$ thefolder/$1 [L]

Completed (!) Now newdomain.com should be showing olddomain.com/thefolder.

Replace with your own domains/folder names for it to work.

This is a totally manual method, but you could create a php script to modify the .htaccess to partially automate it so that users can fill in the form with their domain at olddomain.com.

In theory, you could create a bot on your computer or run a program on server side to fully automate this which might be what blogger.com is doing. However, I don’t think (gs) supports such server side programs.

I not an expert at .htaccess, maybe there is a way to do this where I don’t need to modify it everytime.

3 responses so far

Procut Wordpress Theme Series

You probably are reading here because you have downloaded my theme procut which is available for download at http://themes.wordpress.net/columns/2-columns/4332/procut-1/. I have made a new version which is available for download below.

Procut

  • 5508 downloads (Last check)

I have not updated it for awhile and I am seeing quite an amount of traffic coming in through the theme. So if you have any questions please post it below.

Procut 2 Version 1.0

This is the new version which is more compact.

  1. Smaller width
  2. Sidebar under header
  3. Live Demo
  4. Download it Procut 2 (Downloaded 160 times)

Feedback at comments below.

6 responses so far