Note that there are some explanatory texts on larger screens.

plurals
  1. PORedirect subdomain request to subdirectory in MVC
    primarykey
    data
    text
    <p>So, I currently have a simple MVC web site sat on www.mysite.com and an installation of BlogEngine in a BLOG folder on the root.</p> <p>my question is how, in code, can I redirect a hit on sub.mysite.com to display the blogengine site in the BLOG folder?</p> <p>The sites are currently hosted with WinHost who have suggested using a simple VBScript (seen <a href="https://support.discountasp.net/KB/a369/how-to-redirect-a-subdomain-to-a-subdirectory.aspx" rel="nofollow">here</a>). This is fine but I can't for the life of me figure out where to put it within the MVC site. The link says the "default" document, but is that wihin the body/head? everything I have tried hasn't worked.</p> <p>I know things are all working on the host side of things as hitting sub.mysite.com simply displays the MVC site as it should.</p> <p>I have also read about the rewrite module but I feel this isn't an option because of limitations with my host.</p> <p>Any help would be super awesome!</p> <p><strong>EDIT:</strong> Following Dan Atkinson's post below I have accessed the IIS7 Rewrite Module and created the following rule:</p> <p>Input URL path after ‘/’ Matches (.*) Redirect <a href="http://www.mysite.com/blog/" rel="nofollow">http://www.mysite.com/blog/</a>{R:1} (Stop processing = true, entry type = local)</p> <p>{HTTP_HOST} Matches the Pattern ^blog.mysite.com$</p> <p>{REQUEST_URI} Matches the Pattern /blog</p> <p>the XML for this rull looks like this:</p> <pre><code>&lt;rule name="blog.mysite.com" stopProcessing="true"&gt; &lt;match url="(.*)" /&gt; &lt;conditions logicalGrouping="MatchAll"&gt; &lt;add input="{HTTP_HOST}" pattern="^blog.mysite.com$" /&gt; &lt;add input="{REQUEST_URI}" negate="true" pattern="/blog" /&gt; &lt;/conditions&gt; &lt;action type="Redirect" url="http://www.mysite.com/blog/{R:1}" /&gt; &lt;/rule&gt; </code></pre> <p>This still isn't working though and is still just defaulting to the root site..I feel we are close though! Thank you for all your help so far! </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload