Subdomain Problem

Using a single web hosting account to host multiple sites

Subdomain Problem

Postby Sixfeetunder » Mon Jun 15, 2009 12:52 pm

I read the FAQ. And i try something. I want to my forum actions works in subdomain. My forum is SMF (simple machines forum) and all actions seems like this site.com/forum/index.php?action=action.
I want to change all actions like this http://action.site.com/

My server is Apache 2.1.11 and have mod rewrite i use this
Code: Select all
Options +FollowSymLinks
RewriteEngine On
# Rewrite sub domains.
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^www\.site\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.site\.com$ [NC]
RewriteRule ^(.*)$ /forum/index.php?action=%2 [QSA,L]


Actions works fine but my real subdomains not work (www work fine), get 501 error.
Can you help me ?
Sixfeetunder
 
Posts: 3
Joined: Mon Jun 15, 2009 12:45 pm

Postby richardk » Mon Jun 15, 2009 5:45 pm

Have you set up DNS for the sub domains?
Have you configured the server to send the sub domain requests to the directory containing the mod_rewrite?
Do you have access to the server configuration (the httpd.conf file)?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Sixfeetunder » Tue Jun 16, 2009 3:28 pm

I have access server conf. I have a vps.
I add subdomains from cpanel. So i don't change any dns for my subdomains.
example subdomain conf in my httdconf
Code: Select all
<VirtualHost 94.102.5.22:80>
    ServerName arsiv.xxx.net
    ServerAlias www.arsiv.xxx.net
    DocumentRoot /home/xxx/public_html/arsiv
    ServerAdmin webmaster@arsiv.xxx.net
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/arsiv.rockayseri.net combined
    CustomLog /usr/local/apache/domlogs/arsiv.rockayseri.net-bytes_log "%{%s}t %I .\n%{%s}t %O ."
</VirtualHost>
Sixfeetunder
 
Posts: 3
Joined: Mon Jun 15, 2009 12:45 pm

Postby richardk » Tue Jun 16, 2009 3:35 pm

Code: Select all
    DocumentRoot /home/xxx/public_html/arsiv

needs to be
Code: Select all
    DocumentRoot /home/xxx/public_html

Ie. the document root of the sub domain (sub.example.com) must be the same as the document root of example.com.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Sixfeetunder » Tue Jun 16, 2009 4:04 pm

I try this now. But not worked correctly.
Manually added subdomain(meaning real subdomain) got to my homepage.
I want to if subdomain added manually (in cpanel) subdomain worked normally in its own directory.
So if i add manual subdomain ;
ex : arsiv.site.com, arsiv.site.com should work,
if not add any subdomain
ex: xax, xax.site.com should work for
Code: Select all
RewriteRule ^(.*)$ /forum/index.php?action=%2 [QSA,L]
this rule.

If you want to my httpdconf file i will upload it.
Sixfeetunder
 
Posts: 3
Joined: Mon Jun 15, 2009 12:45 pm

Postby richardk » Wed Jun 17, 2009 11:02 am

Try adding
Code: Select all
<VirtualHost 94.102.5.22:80>
    ServerName wildcard.xxx.net
    ServerAlias *.xxx.net
    DocumentRoot /home/xxx/public_html
    ServerAdmin webmaster@arsiv.xxx.net
    UseCanonicalName Off
</VirtualHost>

to the end of your httpd.conf file.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 16 guests

cron