combine .htaccess and Apache Directives

Discussion in 'Installation/Configuration' started by vistree, Jan 10, 2015.

  1. vistree

    vistree Member HowtoForge Supporter

    Hi, I want to ask, if it is possible to combine .htaccess in web-root-folder and the apache directives field in ispconfig 3.
    Background: I often install Drupal, which brings a .htacces.
    Normally, I put some extra stuff to this file.
    Problem: sometimes on update, the .htaccess is overridden with an updated version.
    Now I hope to put my add-ons in the ipsconfig 3 "apache directives-field" so they are update save.
    What do I have to put there, to get the follwong?
    In the original .htaccess I we already find:
    <IfModule mod_rewrite.c>
      RewriteEngine on
    In this seciton I want to include:
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    RewriteBase /
    Do I have to put the <IfModule mod_rewrite.c> again in the derictives field?
    Do I have to include a directory part?
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, you an use apache directives and .htaccess together.

    Not necessary, mod_rewrite is always on.

    Might not be required by all directives, but it is safer if you do that.
  3. vistree

    vistree Member HowtoForge Supporter

    Hi Till,
    thank you for your reply. Including the SEO-rewrite works fine. But if I include
    RewriteBase /
    this seems to be ingnored??? Do I have to do anything special to make RewriteBase work?
    And, to be sure, are all the existing htaccess-rules from .htaccess still applied? In .htaccess I normally Set RewriteBase / before the existing "master" rules
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !=/favicon.ico
      RewriteRule ^ index.php [L]

Share This Page