I’m migrating an e-commerce app from an old php framework to ASP.NET MVC. Some products have links to other products in their descriptions. I wrote a small app to import everything from the old site to the new site and now I want to update those links too. I would like to make the links relative, but relative links won’t work on localhost because the site is in a virtual directory.
Old link: http://domain/index.php?productID=1234
New link: /product/1234
The new link won’t work in localhost because it will be translated to localhost/product/1234 instead of localhost/virtualdirectory/product/1234.
I’ve been googling for a solution for quite some time but I can’t seem to find anything. Do you have any ideas about how to solve this problem?
I actually came up with a solution while writing the question, but I’m going to post this anyway, maybe you come up with a better solution.
Have you considered not running your app in a virtual directory? While it may be the default in Visual Studio, it can be changed.