subdomain problem

Using a single web hosting account to host multiple sites

subdomain problem

Postby scribzy » Mon Mar 23, 2009 7:34 pm

I was hoping to have Virtual subdomains but my host doesnt support Options +FollowSymLinks :( but does support mod rewrite

i tried:

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.domain\.comt$ [NC]
RewriteRule ^(.*)$ http://domin.com/folder/ [L]

which kind of worked but instead of trying to read information on
http://domin.com/folder/
but it was reading from
http://domin.com/subdomain/folder/
so it was finding 404 file not found :(
is there anyway round this apart from move hosts ?

I have the option for wildcard which i have used but i dont know if i have set it up right.... i have four options for the wildcard:

1. A
2. CNAME
3. Web forward
4. Web alias

i have set wildcard for A???

..........................................................................................................

If there is no way round this is there anyway i can change a 404 redirect in .htaccess so it collects the host before getting redirected eg something like this:
ErrorDocument 404 http://domain.com/folder/index.php?host=%{HTTP_HOST}

:(
?????
Last edited by scribzy on Tue Mar 24, 2009 7:35 pm, edited 3 times in total.
scribzy
 
Posts: 5
Joined: Mon Mar 23, 2009 11:44 am

Postby richardk » Tue Mar 24, 2009 2:27 pm

my host doesnt support Options +FollowSymLinks

Then leave that line out. It is not always required.

What exactly are you trying to achieve?
What should happen when you go to:
  • example.com
  • example.com/something
  • www.example.com
  • www.example.com/something
  • subdomain.example.com
  • subdomain.example.com/something
?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby scribzy » Tue Mar 24, 2009 7:12 pm

im trying to keep subdomain.domain.com in the url
but goto
domain.com/folder/
but at the moment it takes me to
domain.com/subdomain/folder

even tho i add http://domain.com/folder in the line below
RewriteRule ^(.*)$ http://domin.com/folder/ [L]



its for a multisite script iv started writing so the subdomain could be called anything that the user signs up with. (restricted to numbers/letters)


I hope this post is clearer than my last post lol as now reading back through it doesnt make sence lol (to many late nights banging my head against the wall with this lol)
iv now edited post above aswell so it makes more sence :)
scribzy
 
Posts: 5
Joined: Mon Mar 23, 2009 11:44 am

Postby richardk » Wed Mar 25, 2009 3:15 pm

What is the sub domain's document root?

Try
Code: Select all
RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.example\.comt$ [NC]
RewriteRule ^(.*)$ /folder/$1 [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby scribzy » Thu Mar 26, 2009 2:17 pm

i tried it that way originally and it did the same thing so i thought if i added http://domain.com it would sort it out :(

the subdomain document root is:
/customers/domain.com/domain.com/httpd.www
scribzy
 
Posts: 5
Joined: Mon Mar 23, 2009 11:44 am

Postby richardk » Fri Mar 27, 2009 1:35 am

What is the full path to /folder/?

Mod_rewrite cannot rewrite to a directory outside the current document root (of the sub domain). If it is outside the current document root you will need to change the sub domain's document root, create a Symbolic Link or rewrite to a PHP file inside the sub domain's document root that inlcudes the main PHP fie.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby scribzy » Sun Aug 16, 2009 1:51 am

thanks for your help richardk
but the problem is with my host :(

i found 2 soloutions first was to have a new folder created with .htaccess automatically made everytime a new subdomain was made
with modrewrite writing to folder with scripts in :) .... problem with that ....
loads of folders in route directory

better choice Change hosts lol

thanks for your help and keep up the good work :P
scribzy
 
Posts: 5
Joined: Mon Mar 23, 2009 11:44 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 20 guests

cron