Forum Moderators: phranque
I'm on a shared hosting environment and when I create a subdomain it will create a same named folder in my public_html dir but I want a subdomain to point to a different folder in my public_html.
I talked to the webhost (host1plus) but they say this is a global setting which can't be changed.
So now im trying to create a work-around by using htaccess to point everything from:
[nl.domain.com...] (=> public_html/nl/ )
to public_html/ln/
I've tried the following
in .htaccess in public_html/:
RewriteCond %{HTTP_HOST} ^nl\.domain\.com [NC]
RewriteRule ^(.*)$ ln/$1 [L]
which gives 403 error
in .htaccess in public_html/nl/
RewriteRule ^(.*) domains/domain.com/public_html/ln/$1
and
RewriteRule ^(.*) ln/$1
Both give 500 errors
and
RewriteCond %{HTTP_HOST} ^nl\.domain\.com [NC]
RewriteRule ^(.*)$ ln/$1 [L]
and
RewriteCond %{HTTP_HOST} ^nl\.domain\.com [NC]
RewriteRule ^(.*)$ domains/domain.com/public_html/ln/$1 [L]
which also gives errors (500).
I'm running out of ideas to try to fix this. Can someone point me in the right direction.
Thank you very much.
Best regards,
You'll need to either change hosting companies or change to a different level of hosting account.
The cheapest solution is likely to get an "IP-based virtual hosting account." This gives you the freedom to map any subdomain or domain you like to any directory in your account filespace. In the U.S. the typical difference in cost between a name-based virtual hosting account and an IP-based virtual hosting account is $1.00 per month. I'm not sure about .nl or EU pricing, but it should be comparable.
[added] When you get a 500-Server Error, look at your server error log file -- It often contains very useful information to identify the problem. [/added]
Jim
[edited by: jdMorgan at 12:50 pm (utc) on June 23, 2009]
Thanks for your reply.. I actually just switched to this new hosting because they offer multiple server locations which I want to use to make my site faster on different parts on the world and improve SEO.. so that is bad news for me..
Now I though of something that partly solves my problem and I think I can tweak it to make it fully working.
Every request on one of my sub domains is now via .htaccess parsed via 1 file called 'fetch.php' which does some checks and just includes the necessary file from the other folder and displays it. All file requests are working now.. just need to fix the 'virtual folder links' on the subdomains to work but I think I can figure that out also.
Best regards,