0

sorry for my english, I'm french

ok, that's I want to do is to install my drupal site on a url like : www.mymachine.fr/mydrupal/

and the problem is that when I go this url, he dispatch me to www.mymachine.fr/core/install.php instead of www.mymachine.fr/mydrupal/core/install.php

so the install doesn't work

My conf is like this : debian server

in drupal file "sites.php", I have this :

$sites['mymachine.fr.mydrupal'] = 'mydrupal';

on /etc/hosts, I add this line : 127.0.0.1 mymachine.fr.mydrupal

on /etc/apache2/sites-available/000-default.conf :

<VirtualHost *:80>
    ServerName mymachine.fr.mydrupal
    DocumentRoot /var/www/mydrupal/CORE-DRUPAL8-WEB/web

    ServerAdmin webmaster@localhost

    # Log configuration
    ErrorLog ${APACHE_LOG_DIR}/drupal-error.log
    CustomLog ${APACHE_LOG_DIR}/drupal-access.log combined

    <Directory "/var/www/mydrupal/CORE-DRUPAL8-WEB/web">
            Options FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>

</VirtualHost>

SO I don't know if it's drupal configuration or apache configuration to change $base_url from drupal site ... thanks a lot

1

If your drupal installation resides on the webserver in a subfolder of the webroot for www.mymachine.fr, you can set the base path in the drupal site's .htaccess file.

  • Find the line that reads # RewriteBase /drupal
  • Uncomment it by deleting the "#" RewriteBase /drupal
  • Edit it to reflect your subpath/subfolder # RewriteBase /mydrupal

That block should look like this after the edits.

# 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 /mydrupal

Then, reset your .conf (vhost entry) to reflect just the top level website (code sample below resets to default .conf setup):

<VirtualHost *:80>
  ServerName mymachine.fr.mydrupal
  DocumentRoot /var/www

  ServerAdmin webmaster@localhost

  # Log configuration
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined

  <Directory "/var/www">
      Options FollowSymLinks
      AllowOverride All
      Require all granted
  </Directory>
</VirtualHost>

This setup presumes that your top level domain does not have any redirection rules that forward/process all requests (such as the rules in an out-of-the-box Drupal or Wordpress .htaccess for processing requests with index.php) If your top level domain has such a redirect rule in place, you may need to add another rule to exclude your mydrupal subdirectory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.