Hello,

I just ran across a very interesting potential install bug in D7 and I was wondering if it has been carried over to BCMS?

If you neglect to insert 

    <Directory "<wherever_your_website_is">
        AllowOverride All
    </Directory>

prior to the installation, Clean URLs will not be enabled.

If you:

1)  Insert this stanza in your Virtual Host definition file
2)  Restart your web server

Clean URLs should then automagically work.

BUT - should you use the Administration GUI to navigate to Clean URLs in:

Home >> Administration >> Configuration >> Search and metadata 

Your browser URL will look like this:

http://<your_website_url>/#overlay=%3Fq%3Dadmin%252Fconfig%252Fsearch%252Fclean-urls

And you will get an error indicating that Clean URLs cannot be enabled:

Clicking on "Run the clean URL test" simply repeats the message:

Thinking there was something with my setup, I spent quite a bit of time messing around confirming that the Apache Server Rewrite Module (mod_rewrite) was installed, and then testing that the .htaccess file located at:

/var/www/vhosts/<domain>/web/site/.htaccess

Was being processed (by inserting garbage on line 1 and looking for a Web Server 500 error).

In the end, it turned out to be some kind of bug in the Clean URLs post-installation routine.

Simply MANUALLY TYPING the Clean URLs into the browser:

http://<website>/admin/config/search/clean-urls

Got me to the correct screen:

And I was able to:

Check "Enable clean URLs"
Click "Save configuration"

At which point the following confirmation screen appeared:

Apparently, there's some logic issue that prevents the activation of Clean URLs in a post-installation scenario.

Has this situation been rectified in BCMS, or ported over directly from D7?

P.S.  I found this solution (after hours of frustration) in the comments section of:

https://www.drupal.org/forum/support/post-installation/2012-05-11/solved...

Thanks,

g.

 

Comments

@graham-leach I'm not sure that there is a bug, but I found that I needed all those lines in the vhost for clean urls to work with Backdrop.

    AllowOverride All
    Require all granted
    # Following required for Drupal clean urls
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

 

I am running D7U3 on CentOS 7 (yes, I am a dinosaur).

On my system, the lines:

    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Appear in:

/var/www/vhosts/<domain>/web/site/.htaccess

In the following section:
 

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

  # Pass all requests not referring directly to files in the filesystem to
  # index.php. Clean URLs are handled in drupal_environment_initialize().
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

So I did not include them in 

/etc/httpd/conf.d/vhosts.conf

As:

    # GL 2024-01-17    This setting is necessary for CLEAN URLS to work in Drupal
    <Directory "/var/www/vhosts/holisticpethelp.com/www/mobile">
        AllowOverride All
        Require All Granted
        RewriteEngine on
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    </Directory>

Notes:

1)  I don't know if BCMS elected not to do the .htaccess thing, or if there is one at the root of your website directory.  Could you check please?  You might want to check for those instructions in your .htaccess if you have one.

2)  I do not use "Require All Granted" in my implementation and it's working just fine for over a decade now.  Why are you using it?

3)  It looks to me like you may not need the RewriteBase / line, unless you are serving a website with the format  www.domain.com/someplace as your URL, which is non-standard, but entirely possible with the RewriteBase parameter set, with:

https://my.domain.com/drupal_7

Acting as the canonical example.

Looking forward to learning more about this situation with you!

g.

----