How to handle the virtual directory when developing locally?
Answer
Don't use a virtual directory. Remove it from the project’s properties in VS or set up in full IIS as a Website (not Virtual Directory). Credit to Steve Taylor.
Setup a new Website in IIS.
IIS > Connections > Sites > Add Website > Fill in the fields.
Then, Configure Orchard in Visual Studio to use that Website.
Orchard.Web > Properties > Web > Fill in the fields.
Original Question
The problem is, when we upload an image from the live site, the img.src
looks like src="/Media/Default/SomeFolder/someimage.jpg"
, whereas when we upload it from dev site, it looks like src="/Orchard.Web/Media/Default/SomeFolder/someimage.jpg"
, where Orchard.Web
is the virtual directory.
This makes it a pain to use the same images on the live and dev sites, because we must add/remove the virtual directory to/from all the img.src
paths.
Further Questions:
- Is this by design or a bug?
- If it is by design, what is the motivation, and is there a workaround?
- If it is a bug, then can I sign up to fix it?