Built a website on localhost, moved it to shared-hosting where webroot is htdocs
but when visiting the website through the hosting's given IP address it obviously doesn't load the website, because the index.php is inside htdocs/web/
?
This is very limited shared-hosting, no control panel and no way to edit apache's configs, only .htacess files accessible in htdocs
.
Current attempts:
a. Homepage loads fine, but /web/
is added in the URL in the address bar for every sub-page.
RewriteEngine On
RewriteRule ^(.*)$ /web/$1 [L]
b. Homepage loads and no /web/
is added for any links in e.g. main menu navigation while from homepage and clicking them even loads the page without /web/
added to the URL, but the /web/
is added back to the menu once you're within any subpage.
RewriteRule ^(.*)$ web/$1 [L,NC]
Same menu links from within subpages
Interesting find, while you can visit content pages from menu links, you cannot access e.g. /user
when trying to login, you get WSOD Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.
You have to enter web/user
in order to login.
update: Similar issue described here https://www.drupal.org/forum/support/installing-drupal/2022-02-21/redirects-to-external-urls-are-not-allowed-by-default-use-drupalcoreroutingtrustedredirectresponse#comment-14996104 but no actual solution, only the mention of the redirection to /web/? How to redirect properly without /web/ showing in URL adress bar?