PDA

View Full Version : making a domain point to a subdomain


ciaranharron
8-18-05, 06:30 AM
I have a primary domain eg xxx.com. I have created a subdomain called yyy.xxx.com by creating a subdirecory /yyy in my root directory.

I have a second domain yyy.com and I want to make it point to yyy.xxx.com so that I can access the same pages via either yyy.com or yyy.xxx.com.

I have set up .htaccess in /htdocs to point to yyy.com to a subdirectory yyy. The problem is that yyy.com now points to /htdocs/yyy whereas yyy.xxx.com points to /yyy.

How can I make yyy.com point to /yyy so that I can access my pages in /yyy/htdocs? As far as I can see .htaccess only works if the subdir is under /htdocs?

Ciaran

ciaranharron
8-18-05, 07:00 AM
rename which directories in my case?

ciaranharron
8-18-05, 07:35 AM
Sorry I don't understand. If I use subdomain I access /yyy/htdocs. If I use the 2nd domain with pointer in .htaccess I access /htdocs/yyy. These are different directories?

IanS
8-18-05, 07:51 AM
Sorry I don't understand. If I use subdomain I access /yyy/htdocs. If I use the 2nd domain with pointer in .htaccess I access /htdocs/yyy. These are different directories?Two different methods and different terminologies seem to be being used here.

You can use the Powweb easy sub-domain method by creating a sub-folder level with htdocs and placing a new htdocs folder inside that one.

/htdocs
/sub1/htdocs

or you can use the .htaccess method (best if you're using a pointed domain as well)

For .htaccess details look in the knowledge base, it has all you need in there :)

http://kb.powweb.com

http://kb.powweb.com/questions/369/Subdomains-and-Additional-Domains

extras
8-18-05, 09:28 AM
I have a primary domain eg xxx.com. I have created a subdomain called yyy.xxx.com by creating a subdirecory /yyy in my root directory.

I have a second domain yyy.com and I want to make it point to yyy.xxx.com so that I can access the same pages via either yyy.com or yyy.xxx.com.

I have set up .htaccess in /htdocs to point to yyy.com to a subdirectory yyy. The problem is that yyy.com now points to /htdocs/yyy whereas yyy.xxx.com points to /yyy.

How can I make yyy.com point to /yyy so that I can access my pages in /yyy/htdocs? As far as I can see .htaccess only works if the subdir is under /htdocs?

CiaranYou can't so that with PowWeb's easy method subdomain (the method you used),
unless you use symlink.
Usually, people are not really familiar with symlink and not so many people are using it
eventhough it's very handy in some cases.

Other than symlink method, you can do manually following the kb as IanS indicated..
Or you can use DomainManager.http://check-these.info/DomainManager.html

If you do manual setup, this is optimized .htaccess code for your case.

RewriteEngine on
RewriteBase /

# Code for missing Trailing slashe problem (You can remove it if you don't want.)
RewriteCond s%{HTTPS} ^((s)on|s.*)$
RewriteRule ^/*(.+/)?([^.]*[^/])$ http%2://%{HTTP_HOST}/$1$2/ [L,R=301]

# Sub/pointer domain rewrite code
RewriteCond %{REQUEST_URI} !^/+yyy/
RewriteCond %{HTTP_HOST} ^(www\.)?yyy\.(xxx\.)?com$ [NC]
RewriteRule ^(.*)$ yyy/$1

ciaranharron
8-23-05, 02:56 AM
Okay I'm using the .htaccess method now rather than the easy subdomain.

One further problem that I'm now having is that my main page is not loaded automatically. If I try http://www.directaid4aceh.org the main page does not load. If I try http://www.directaid4aceh.org/index.php then it loads ok.

If this a problem because I'm using PHP? Is there something else I need to specify in .htaccess?

Ciaran

ciaranharron
8-23-05, 03:11 AM
I just solved this. Dreamweaver very intelligently created a dummy index.htm for me as it saw I didn't have one (although it didn't see I have index.php). I deleted index.htm and everything is now perfect.

Ciaran