diff --git a/Kavita.Server/Controllers/FallbackController.cs b/Kavita.Server/Controllers/FallbackController.cs
index 29012ba999512815ac5cdd45eccf2a01f228aae0..31d96c93580e211f4e444c0a4be3ee3099461544 100644
--- a/Kavita.Server/Controllers/FallbackController.cs
+++ b/Kavita.Server/Controllers/FallbackController.cs
@@ -18,7 +18,7 @@ public class FallbackController : Controller
             return NotFound();
         }
 
-        return PhysicalFile(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "index.html"), "text/HTML");
+        return PhysicalFile(Path.Combine("@webroot@", "index.html"), "text/HTML");
     }
 }
 
diff --git a/Kavita.Server/Startup.cs b/Kavita.Server/Startup.cs
index 924c9ceb0cafacbc873eaa9e16d184d215bb761d..46847d73f0da1e6c93b0e6120b256e1c1169d83f 100644
--- a/Kavita.Server/Startup.cs
+++ b/Kavita.Server/Startup.cs
@@ -48,6 +48,7 @@ using Microsoft.AspNetCore.StaticFiles;
 using Microsoft.Extensions.Caching.Hybrid;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.FileProviders;
 using Microsoft.Extensions.Hosting;
 using Microsoft.Extensions.Logging;
 using Microsoft.Net.Http.Headers;
@@ -275,8 +276,6 @@ public class Startup
         app.UsePathBase(basePath);
         if (!env.IsDevelopment())
         {
-            // We don't update the index.html in local as we don't serve from there
-            UpdateBaseUrlInIndex(basePath);
 
             // Update DB with what's in config
             var dataContext = serviceProvider.GetRequiredService<DataContext>();
@@ -316,6 +315,7 @@ public class Startup
         // Ensure static files is before our custom middleware stack
         app.UseStaticFiles(new StaticFileOptions
         {
+            FileProvider = new PhysicalFileProvider("@webroot@"),
             // bcmap files needed for PDF reader localizations (https://github.com/Kareadita/Kavita/issues/2970)
             // ftl files are needed for PDF zoom options (https://github.com/Kareadita/Kavita/issues/3995)
             ContentTypeProvider = new FileExtensionContentTypeProvider
@@ -534,7 +534,7 @@ public class Startup
         try
         {
             var htmlDoc = new HtmlDocument();
-            var indexHtmlPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "index.html");
+            var indexHtmlPath = Path.Combine("@webroot@", "index.html");
             htmlDoc.Load(indexHtmlPath);
 
             var baseNode = htmlDoc.DocumentNode.SelectSingleNode("/html/head/base");
diff --git a/Kavita.Services/DirectoryService.cs b/Kavita.Services/DirectoryService.cs
index 38c88eeead9812895046e776667c9540bf4662a5..79ac745ef2f8ae630d74d605083a5b597aedbcec 100644
--- a/Kavita.Services/DirectoryService.cs
+++ b/Kavita.Services/DirectoryService.cs
@@ -1,4 +1,4 @@
-﻿using System;
+using System;
 using System.Collections.Generic;
 using System.Collections.Immutable;
 using System.IO;
@@ -66,7 +66,7 @@ public class DirectoryService : IDirectoryService
         ExistOrCreate(SiteThemeDirectory);
         FaviconDirectory = FileSystem.Path.Join(FileSystem.Directory.GetCurrentDirectory(), "config", "favicons");
         ExistOrCreate(FaviconDirectory);
-        LocalizationDirectory = FileSystem.Path.Join(FileSystem.Directory.GetCurrentDirectory(), "I18N");
+        LocalizationDirectory = FileSystem.Path.Join("@out@/lib/kavita-backend", "I18N");
         CustomizedTemplateDirectory = FileSystem.Path.Join(FileSystem.Directory.GetCurrentDirectory(), "config", "templates");
         ExistOrCreate(CustomizedTemplateDirectory);
         TemplateDirectory = FileSystem.Path.Join(FileSystem.Directory.GetCurrentDirectory(), "EmailTemplates");
diff --git a/Kavita.Services/LocalizationService.cs b/Kavita.Services/LocalizationService.cs
index 5597f05cf65dac448bc893aeee8e6ecc0a0d58c7..c8b2746d45d547d4544ef2022c8bcc360772383f 100644
--- a/Kavita.Services/LocalizationService.cs
+++ b/Kavita.Services/LocalizationService.cs
@@ -1,4 +1,4 @@
-﻿using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text.Json;
@@ -51,9 +51,7 @@ public class LocalizationService : ILocalizationService
         }
         else
         {
-            _localizationDirectoryUi = directoryService.FileSystem.Path.Join(
-                directoryService.FileSystem.Directory.GetCurrentDirectory(),
-                "wwwroot", "assets/langs");
+            _localizationDirectoryUi = directoryService.FileSystem.Path.Join("@webroot@", "assets/langs");
         }
 
         _cacheOptions = new MemoryCacheEntryOptions()

