• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[HTACCESS] Subdomains + Specific Directory

Status
Not open for further replies.
Custom Title Activated
Loyal Member
Joined
Dec 10, 2007
Messages
2,194
Reaction score
263
I have recently figured out how to setup a wild card subdomain that allows me to use any subdomain that I want on my main domain.
Code:
*.domain.com

However, I'm having an issue with specifying which directory I want all wild card subdomains to use. At the moment they're using the main directory for the domain (domain.com/). The problem is that I would like all wild card subdomains to use /specificdir/ (domain.com/sepcificdir/) by default.

I hope that made some sense. :scared:
 
Newbie Spellweaver
Joined
Nov 2, 2009
Messages
54
Reaction score
21
Google "apache virtualhost" and you'll get your answer.
 
Custom Title Activated
Loyal Member
Joined
Dec 10, 2007
Messages
2,194
Reaction score
263
It doesn't matter if it's mod_rewrite or .HTACCESS based. The only thing that matters if the solution works. I've honestly been searching for hours - but not knowing what to look for in the code makes it very hard for me.
 
Newbie Spellweaver
Joined
Nov 2, 2009
Messages
54
Reaction score
21
Open your your httpd.conf
Add those lines at the end of it (ofc replace with the correct values)

Code:
<VirtualHost *:80>
DocumentRoot C:\PathTo\subdomainone
ServerName subdomain1.mywebsite.com

</VirtualHost>

<VirtualHost *:80>
DocumentRoot C:\PathTo\subdomaintwo
ServerName subdomain2.mywebsite.com

</VirtualHost>

Restart your webserver
 
Custom Title Activated
Loyal Member
Joined
Dec 10, 2007
Messages
2,194
Reaction score
263
Open your your httpd.conf
Add those lines at the end of it (ofc replace with the correct values)

Code:
<VirtualHost *:80>
DocumentRoot C:\PathTo\subdomainone
ServerName subdomain1.mywebsite.com

</VirtualHost>

<VirtualHost *:80>
DocumentRoot C:\PathTo\subdomaintwo
ServerName subdomain2.mywebsite.com

</VirtualHost>

Restart your webserver
Is it possible to make the subdomain "global"? Instead of having to add the subdomains individually as I'm using wildcard subdomaions and every subdomain has to use the same directory to run the script I'm using.

EDIT:
Problem solved. Thanks for all the help guys.
 
Last edited:
Status
Not open for further replies.
Back
Top