'How to adjust htaccess for Drupal9 so website opens as www.mydomain.com from a subfolder of the root not root
I have a question about .htaccess for Drupal 9. I created the page on localhost using a composer and copied a locally prepared instance of Drupal9 to the web hosting, which runs from a subfolder (www / web / index.php). To guarantee opening from www.mydomain.com on the web hosting, I created a new .htaccess with these variables in the root folder www : '''
RewriteEngine on RewriteRule ^$ web/index.php [L] RewriteCond %{DOCUMENT_ROOT}/web%{REQUEST_URI} -f RewriteRule .* web/$0 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* web/index.php?q=$0 [QSA]
RewriteCond %{HTTP_HOST} ^http://something.ws/$ RewriteCond %{REQUEST_URI} !^/web/ RewriteRule (.*) /web/$1 [L] ''' With this I was able to open a domain from www.mydomain.com. The home page is loading So it's OK in this part.
The problem occurs when I want to open a web page from the home page or log in. After a shredding for a while, it throws up the error ‘The page isn’t redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies. ’ The following is repeated in the address bar: '''
/ user / login? Q = user / login & q = user / login & q = user / login '''
Similar problem occurred with other links. I want to ask: How to fix this usinh .htaccess
- How to prevent this creation of loops in htaccess
- I created a new htaccess in root www. Other htaccess under the web and in sites / default are unchanged
- Is it necessary to make any change in the other htaccess /web, sites / defaults? I also asked the provider if it is possible to change the hosting address, unfortunately it only goes through htaccess. Thank you for any comments or advice
Solution 1:[1]
Could it be you hit https://www.drupal.org/project/redirect/issues/3096948 ? At least that's the cause for the exact same loop in my case.
In short, the "redirect" module - if you use it - seems to be buggy.
Try disabling route_normalizer_enabled in its config, either by changing the variable in the redirect.settings.yml config file and using drush to import the changed config (drush cim), or by issuing
drush cset redirect.settings route_normalizer_enabled 0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | tgoeg |
