How to remove /drupal from URL in Drupal 7 when installation is in the associated sub-directory

前端 未结 3 1546
感动是毒
感动是毒 2021-02-10 18:47

In Drupal 6 I was able to successful install Drupal in a subdirectory called drupal and then reference the site without having to use example.com/drupal. In Drupal 6 to get this

3条回答
  •  北海茫月
    2021-02-10 19:37

    Try with this :

    RewriteEngine On
    
    RewriteBase /example.com
    RewriteRule ^$ drupal/ [L]
    
    # rewrite rules for drupal files
    RewriteCond %{DOCUMENT_ROOT}/example.com/drupal/$1 -f
    RewriteRule ^(.*)$ drupal/$1 [L,QSA]
    
    # rewrite rules for drupal paths
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ drupal/index.php?q=$1 [L,QSA]
    

    Put this .htaccess file in example.com directory. You don't have to modify drupal7 .htaccess

提交回复
热议问题