Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Local core dev directory located at "http://localhost/sandbox/core-dev/webroot".
Fresh install, went thru installation OK until last step, clicked "Visit your new site" link shown at URL "http://localhost/sandbox/core-dev/webroot/core/install.php?langcode=en&p..."
URL not found at "http://localhost/sandbox-dev/webroot/"
Found obvious cause at line 2006 of install.core.inc:
// Ensure the URL that is generated for the home page does not have 'install.php'
// in it.
$request = Request::createFromGlobals();
$generator = Drupal::urlGenerator();
$generator->setBasePath(str_replace('/core', '', $request->getBasePath()) . '/');
$generator->setScriptPath('');
$url = $generator->generateFromPath('');
$output .= '<p>' . (isset($messages['error']) ? t('Review the messages above before visiting <a href="@url">your new site</a>.', array('@url' => $url)) : t('<a href="@url">Visit your new site</a>.', array('@url' => $url))) . '</p>';
Maybe str_repping for "/core/" instead of "/core" would mitigate this, although not a perfect solution.
Comment | File | Size | Author |
---|---|---|---|
#11 | drupal--2045685--broken-url-after-install-if-core-in-path--11.patch | 1.15 KB | amontero |
#10 | drupal-8-2045685-10.png | 44.56 KB | rhm5000 |
#10 | drupal-8-w_index-2045685-10.png | 53.64 KB | rhm5000 |
#5 | 2045685-Broken-URL-after-install-5.png | 24.38 KB | rhm5000 |
#4 | drupal--2045685--broken-url-after-install-if-core-in-path--4.patch | 1.15 KB | amontero |
Comments
Comment #1
rhm5000 CreditAttribution: rhm5000 commentedI was able to reproduce the bug in the minimal installation.
In the standard installation I did not have an issue with the link for Visit your new site in the last step.
Comment #2
rhm5000 CreditAttribution: rhm5000 commentedClean urls are do not seem to be enabled by default in the minimal installation.
Change record 'clean_url' configuration setting removed; clean URLs are autodetected each request indicates the change from 7 to 8.
Comment #3
rhm5000 CreditAttribution: rhm5000 commentedDoes changing the configuration of RewriteBase in .htaccess when using virtual directories do anything?
Comment #4
amonteroThanks rhm50.
I'm using Drupal's default .htaccess and Apache default vhost on Ubuntu. Which change do you suggest?
Aside from this, I don't see how this can address the issue, since "/core" would stay in the path.
Anyway, I've found a solution that works with some easy regex. Let's see what the testbot says. Tested only using "minimal" profile.
Comment #5
rhm5000 CreditAttribution: rhm5000 commented(edit) Lines 106 or 110 in [drupal_install]/.htaccess to RewriteBase /[web_alias]/[drupal_install] can be changed to accommodate Virtual Directories.
I am getting another error similar to this when trying to access other admin links /admin/appearance, /admin/appearance, /admin/structure. All of the url paths work fine if I prepend index.php ie., http://localhost/[web_alias]/[drupal_install]/index.php/admin/modules.
Not sure the patch will address problems with other urls. I have attached a screenshot of the error I'm getting.
Comment #6
rhm5000 CreditAttribution: rhm5000 commentedI applied the patch in #5 still see the same problem, receiving 404 error, and not seeing homepage. Again, accessing the page via http://localhost/[web_alias]/[drupal_install]/index.php/[drupal_path] works.
Comment #7
rhm5000 CreditAttribution: rhm5000 commentedCheck out issue #432384 Any non-existant URL containing a valid parent path returns 200, not 404 looks similar to the error seen in this issue. The error does not show up on the minimum install when changing RewiteBase /[web-alias]/[drupal_install] or RewiteBase /[drupal_install].
Comment #8
amonteroThx, rhm50.
I have none of such issues you mention. Plain LAMP and Drupal's unmodified .htaccess . Clean URLs enabled and working OK all the time.
The problem I'm having is because my local dev URL contains "core" and looks like to me it's just a string manipulation issue in one specific piece of code.
Maybe you should check for similar issues or create another with your configuration and steps to reproduce.
Comment #9
amonteroMakes it for an easy issue to handle and review.
Comment #10
rhm5000 CreditAttribution: rhm5000 commentedInitialy I used xmapp 1.8.3 on Windows 7, Apache distribution containing MySQL, PHP and Perl, with mod_rewrite enabled, to test the drupal minimal install. I did the same procedure as before but on Ubuntu 12.04 using simple lamp install with mod_rewrite enabled, and I am also using mod_userdir. I am not using xmapp but instead a normal linux install of Apache, Mysql and PHP.
Again, I beleive this is similar to issue #432384 , if not a duplicate. The 404 Page not found error is what I see when accessing the page via http://localhost/~username/[drupal_site], I do not see this error when adding index.php to the url i.e., http://localhost/~username/[drupal_site]/index.php which the issue describes.
After clicking on the link for Visit your new site after the install, I am redirected from http://localhost/~username/[drupal_site] to http://localhost/~username/[drupal_site]/user/1 which returns the 404 Page not found error.
I have attached two screen shots from the Ubuntu 12.04 drupal install one using the index.php in the url and one without.
Comment #11
amonteroTracking HEAD.
@rhm50: looks like to me that none of the issues you mention or link are related to this one. This issue refers *only* to an incorrectly crafted URL at *install wizard finish page* if the URL contains the string "/core" in the path. Only in that particular screen (Updating issue to better reflect this).
Comment #12
mErilainen CreditAttribution: mErilainen commentedPatch works as it should.
I had to check what the number signs (#) do in the regex in the patch. They function as delimiter, "/" is more commonly used but "#" is easier to read in this case when it comes to front and/or backslashes.
https://en.wikipedia.org/wiki/Leaning_toothpick_syndrome
Comment #13
alexpottCommitted 4351d67 and pushed to 8.x. Thanks!