I'm trying to set up a sub domain for development on a windows server and am having problems setting the correct details in the httpd.ini file and hoped someone could help.

I have set up the subdomain

http://dev.website.com

The files that I want to use for this subdomain are on the server in a folder called development

http://www.website.com/development

in the directory structure they are in

/htdocs/development

What do I need to add the the httpd.ini file to point the http://dev.website.com to the files located in the /htdocs/development folder on the server?

link|improve this question
1  
What webserver are you using? Is httpd.ini what Apache-on-Windows calls httpd.conf? – Rup Jun 17 '10 at 15:05
@rup I believe it's ISAPI Rewrite isapirewrite.com/docs and I think they support a very similar rewrite syntax to Apache – Jeff Atwood Jun 18 '10 at 5:38
possible duplicate of creating a subdomain on windows server – MikeyB Jun 24 '10 at 4:41
feedback

migrated from stackoverflow.com Jun 18 '10 at 5:36

This question came from our site for professional and enthusiast programmers.

2 Answers

Aren't vhosts supposed to be implemented as vhosts instead of rewrites?

http://httpd.apache.org/docs/1.3/vhosts/examples.html

dev.website.com /htdocs/development

<VirtualHost *:80>
DocumentRoot /htdocs
ServerName www.website.com
ServerAlias website.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /htdocs/development
ServerName dev.website.com
ServerAlias www.dev.website.com
</VirtualHost> 
link|improve this answer
feedback

Yes its ISAPI rewrite I think.

@Jeff - thanks for the link i'll take a look and try to work it out.

Ok so I tried adding the following to the httpd.ini file and its not working. Is this what i need to be doing?

#Fix missing trailing slash char on folders RewriteRule ^([^.?]+[^.?/])$ $1/ [R]

#Fix duplicate content problem

RewriteCond %{HTTP:Host} .*myserver.com$ [NC] RewriteRule ^/subdomain/([^/?]+)(.+) http://$1.myserver.com$2 [NC,R=301]

#Map requests to the folders

RewriteCond %{HTTP:Host} ^(?!www.)([^.]+).myserver.com [NC] RewriteRule (.*) /subdomain/%1$1

link|improve this answer
feedback

Your Answer

 
or
required, but never shown