Hi,
We are having problem using subfolder in url, example:
http://domainName.com/weboholics
We have tried two approaches:
(What we think is the right way) Rewrite url in nginx
(nginx configuration)
rewrite ^(/weboholics)(.*)$ $2 break;
With this approach razor get confused and @Url.Action("Index","Home") returns:
/Home/Index when the correct url should be
/weboholics/Home/Index
We have asked others, and they have suggested to use WebHostBuilder().UseUrls("http://domainName.com/weboholics"), but seems not feasible due to our usage of Unix Socket
(our UseUrl)
.UseUrls("http://unix:/var/disk2/sparfiler/www/weboholics.sock")
Second approach - change routing
With this approach Razor Url.Action() works but this doesn't work in Razor:
(code)
<script type="application/ecmascript" src="~/ckeditor/ckeditor.js"></script>
Razor will render this to:
<script type="application/ecmascript" src="/ckeditor/ckeditor.js" ></script>
(How it should be)
<script type="application/ecmascript" src="/weboholics/ckeditor/ckeditor.js" ></script>
Our startup (both approaches )
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseUrls("http://unix:/var/disk2/sparfiler/www/weboholics.sock")
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
What is the correct approach for using subfolders? especially in an Linux + nginx environment?
Best Regards
Jesse / Weboholics