View Full Version : Subdomain Confusion
rthornley
05-16-2009, 03:13 PM
I just added the subdomain addon and I am now trying to figure out how to use it.
My site currently has a number of folders and files in the root folder. I want to add a staging subdomain as in “staging.mydomain.com” so it seems like I would create “staging” folder at the root level and place my files in there which makes sense.
What does not make sense to me is what to do with the files and folders that are currently in the root folder for www.mydomain.com (http://www.mydomain.com/). Do I leave the current files and folders as they are, or do they need move them into a folder off the root? If this were true, then I would only have two folders and one file to do the redirecting.
wisemx
05-17-2009, 09:20 AM
Hi,
DASP allows you to code it how you want.
When you add your own Sub-domains you can code it to take the visitor/page to any folder or page on your site.
You do not have to create a folder named "staging" for a sub-domain named "staging" but you can.
There are code examples in the Support site and you can find many examples here in the forums, plus on the official ASP.NET site.
Salute,
Mark
rthornley
05-17-2009, 11:16 AM
Thanks for the reply. I think I have the subdomain figured out but I guess I am still confused on how to handle the current site.
I want the url of the current site to be www.mydomain.com (http://www.mydomain.com) as that is the "live" site and "staging" is where I will be working on the new aspx version of the site. It looks like the redirect code goes at the top of the file "default.aspx" in the root folder but that is the startup page for my current site. I really do not want my "live" site startup page to be anything other then "default.asp".
If the redirect code only contains a redirect to "staging.mydomain.com" will the process "fall through" if someone was trying to access my "live" site?
Thanks
Richard
rthornley
05-17-2009, 03:10 PM
Here is what I have done so for and my results and questions.
In my root folder I put the following code at the top of my default.asp:
<%
If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("staging.mydomain.com") ) > 0 Then
Response.Redirect("/staging")
End If
%>
So with that code "http://www.mydomain.com (http://www.mydomain.com/)" works properly since it falls through.
I created a “staging” subfolder and placed some test pages and another subfolder named “siteadmin”.
To test I used the url "http://staging.mydomain.com/ (http://staging.mydomain.com/)" which goes to the subdomain put the url looks like http://staging.mydomain.com/staging (http://staging.mydomain.com/staging). The subfolder name is attached to the url which is not what I want.
I next wanted to see what happens when I try to access the subfolder “siteadmin” in the “staging” folder as in "http://staging.mydomain.com/siteadmin (http://staging.mydomain.com/siteadmin)". I tried this code:
<%
If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("staging.mydomain.com/siteadmin") ) > 0 Then
Response.Redirect("/staging/siteadmin")
ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("staging.mydomain.com") ) > 0 Then
Response.Redirect("/staging")
End If
%>
But I get the error "The system cannot find the path specified.".
Can another clear this up for me as I would really like to quit pulling my hair out before I don’t have anymore!
Thanks,
Richard
wisemx
05-17-2009, 04:40 PM
Hi,
You should add at least one more catch or fail/passthrouh to that.
Instead of dropping the ball if the two strings don't exist add a failure, i.e.:
Else
Response.Redirect("http://staging.mydomain.com/staging")
End If
rthornley
05-18-2009, 03:00 PM
Thanks for the reply! Good Idea.
Any thoughts on why http://staging.mydomain.com/siteadmin (http://staging.mydomain.com/siteadmin) generates the error "The system cannot find the path specified." and why using "staging.mydomain.com" in the redirect code redirects to http://staging.mydomain.com/staging (http://staging.mydomain.com/staging) (notice the "staging" at the end. I thought the redirect code would redirect to http://staging.mydomain.com without the ending /staging.
Thanks,
Richard
wisemx
05-18-2009, 05:48 PM
Hi,
Well to be honest I'd just place a closing slash each time you code it.
i.e. http://staging.mydomain.com/staging/
Salute,
Mark
rthornley
05-19-2009, 08:30 AM
Hello
Thanks again for the reply but I really must not be explaining this correctly.
When I type into the browser http://staging.mydomain.com I end up going to http://staging.mydomain.com/staging, not what I want. I want that last "staging" removed.
When I type into the browser http://staging.mydomain.com/siteadmin I end up with the error, displayed in the browser, "The system cannot find the path specified.
Can I use IIS at discountasp to take care of the subdomains rather then using redirect code?
Can anyone help with these issues?
Thank You,
Richard
bruce
05-20-2009, 09:27 AM
No.. IIS cannot handle sub domain going to a sub directory in our setup. TEchnically, you'll have to setup an additional site on IIS to do that.
vBulletin® ©Jelsoft Enterprises Ltd.