Reputation: 1800
I'm currently making a link shortening service on my hosting package. I'm using URL rewrites to do this. An example of this working is here - dysign.co.uk/xBbYPL. This redirects you to Google.de. I'm using another domain mapped to a folder on my hosting package, so I have 2 sites on 1 hosting plan.
freeyoutubedownloaders.co.uk is mapped to dysign.co.uk/freeyoutubedownloaders. The link shortener is in the freeyoutubedownloaders folder therefore dysign.co.uk/freeyoutubedownloaders/xBbYPL works perfectly fine but if you go to freeyoutubedownloaders.co.uk/xBbYPL then you get a 404 file not found error.
Here's my rewrite rule in my web.config file:
<rewrite>
<rules>
<rule name="Links">
<match url="^X.{5,5}$" />
<action type="Rewrite" url="Link.aspx?id={R:0}" />
</rule>
</rules>
</rewrite>
I've also turned on detailed httpErrors if anyone wants to have a look for me.
Lastly I noticed on the error screen it says:
Requested URL http://freeyoutubedownloaders.co.uk:80/freeyoutubedownloaders/xBbYPL
Why is it referring to the domain and then the folder? The Link.aspx page loads fine... (To test it, add ?id=xBbYPL to the end for it to redirect you.)
Ps. I'm not able to access IIS at all due to it being hosted on 123-reg.co.uk
Thanks again! :)
Error:
Upvotes: 1
Views: 569
Reputation: 6138
I get the feeling that the domain name freeyoutubedownloaders.co.uk
has been added as an additional binding to the same website as dysign.co.uk
. And somehow (I don't know how 123reg is setting this up usually) request for freeyoutubedownloaders.co.uk/<something>
get rewritten to /freeyoutubedownloaders/<something>
. Or they have set up some kind of reverse proxy for it without you knowing it.
When I test this on IIS 7.5 by setting up one website for dysign.co.uk
and a separate website for freeyoutubedownloaders.co.uk
pointing to the /freeyoutubedownloaders
directory in the root directory of where dysign.co.uk
is pointing to, it all works as expected. So I don't think there is anything wrong with your thinking on how you want this to work but I think 123reg has done something unusual in the way it binds the domain names to your site(s).
Upvotes: 1