NEW ERROR: RewriteEngine not allowed here

Discussion in 'Installation/Configuration' started by gkovacs, Apr 17, 2009.

  1. till

    till Super Moderator Staff Member ISPConfig Developer

    This tutorial is for a private server and not ispconfig or for a hosting enviroment. As long as you are the only user, then AllowOverride all is fine.
     
  2. Ovidiu

    Ovidiu Active Member

    ok, here is the .htaccess from a not-working site:
    Code:
    # preventing hotlinking
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(.*)?domain1.com(/)?.*$ [NC]
    RewriteRule .*.(gif|jpe?g|png|bmp)$ [F,NC]
    
    Redirect 301 /category/blog http://domain1.com/
    
    # BEGIN WPSuperCache
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    AddDefaultCharset UTF-8
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f
    RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f
    RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L]
    </IfModule>
    
    # END WPSuperCache
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    here is a .htaccess from a working site:
    Code:
    # preventing hotlinking
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(.*)?domain2.com(/)?.*$ [NC]
    RewriteRule .*.(gif|jpe?g|png|bmp)$ [F,NC]
    
    # BEGIN WPSuperCache
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    AddDefaultCharset UTF-8
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{QUERY_STRING} ^$
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{HTTP:Cookie} !^.*(wordpress|comment_author_|wp-postpass_).*$
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}_%{SERVER_PORT}/$1/index.html.gz -f
    RewriteRule ^(.*) /wp-content/cache/supercache/%{SERVER_NAME}_%{SERVER_PORT}/$1/index.html.gz [L]
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{QUERY_STRING} ^$
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{HTTP:Cookie} !^.*(wordpress|comment_author_|wp-postpass_).*$
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}_%{SERVER_PORT}/$1/index.html -f
    RewriteRule ^(.*) /wp-content/cache/supercache/%{SERVER_NAME}_%{SERVER_PORT}/$1/index.html [L]
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{QUERY_STRING} ^$
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{HTTP:Cookie} !^.*(wordpress|comment_author_|wp-postpass_).*$
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}_%{SERVER_PORT}/$1/index.html.gz.wip -f
    RewriteRule ^(.*) /wp-content/cache/supercache/%{SERVER_NAME}_%{SERVER_PORT}/$1/index.html.gz.wip [L]
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{QUERY_STRING} ^$
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{HTTP:Cookie} !^.*(wordpress|comment_author_|wp-postpass_).*$
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}_%{SERVER_PORT}/$1/index.html.wip -f
    RewriteRule ^(.*) /wp-content/cache/supercache/%{SERVER_NAME}_%{SERVER_PORT}/$1/index.html.wip [L]
    </IfModule>
    
    # END WPSuperCache
    
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    
    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]
    RewriteRule ^(.*/)?sitemap.xml wp-content/sitemap.php [L]
    
    #avatar rule
    RewriteRule ^(.*/)?avatar/(.*) wp-content/avatar.php?file=$2 [L]
    
    #RewriteRule ^wp-content/blogs.dir/(\d+)/themes/(.*) wp-content/blogs.dir/$1/themes/$2 [L]
    
    #google sitemap verification
    RewriteRule ^google(.*).html googleverifyfile.html
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    
    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ /$1/ [R=301,L]
    
    # END WordPress
    
    there are some differences but the first one is wordpress the second one is wpmu, still its only redirect and rewrites.

    Now a non working vhost file:
    Code:
    <Directory /var/www/domain1.com>
        AllowOverride None
        Order Deny,Allow
        Deny from all
    </Directory>
    
    <VirtualHost *:80>
        DocumentRoot /var/www/clients/client1/web7/web
        ServerName domain1.com
        ServerAlias www.domain1.com
        ServerAdmin [email protected]
        ErrorLog /var/log/ispconfig/httpd/domain1.com/error.log
    
        <Directory /var/www/domain1.com/web>
            Options FollowSymLinks
            AllowOverride Indexes AuthConfig Limit FileInfo
            Order allow,deny
            Allow from all
        </Directory>
    
        <Directory /var/www/clients/client1/web7/web>
            Options FollowSymLinks
            AllowOverride Indexes AuthConfig Limit FileInfo
            Order allow,deny
            Allow from all
        </Directory>
    
        # suphp enabled
        <Directory /var/www/clients/client1/web7/web>
            suPHP_Engine on
            # suPHP_UserGroup web7 client1
            AddHandler x-httpd-suphp .php .php3 .php4 .php5
            suPHP_AddHandler x-httpd-suphp
        </Directory>
    
    </VirtualHost>
    
    
    and here is a working vhost:
    Code:
    <Directory /var/www/domain2.com>
        AllowOverride None
        Order Deny,Allow
        Deny from all
    </Directory>
    
    <VirtualHost *:80>
          DocumentRoot /var/www/domain2.com/web
        ServerName domain2.com
        ServerAlias *.domain2.com
        ServerAdmin [email protected]
        ErrorLog /var/log/ispconfig/httpd/domain2.com/error.log
    
    
        <Directory /var/www/domain2.com/web>
            Options FollowSymLinks
            AllowOverride Indexes AuthConfig Limit FileInfo
            Order allow,deny
            Allow from all
        </Directory>
    
        <Directory /var/www/clients/client1/web9/web>
            Options FollowSymLinks
            AllowOverride Indexes AuthConfig Limit FileInfo
            Order allow,deny
            Allow from all
        </Directory>
    
        # suexec enabled
        SuexecUserGroup web9 client1
        # php as fast-cgi enabled
        <Directory /var/www/domain2.com/web>
            AddHandler fcgid-script .php .php3 .php4 .php5
            FCGIWrapper /var/www/php-fcgi-scripts/web9/.php-fcgi-starter .php
            Options +ExecCGI
            AllowOverride all
            Order allow,deny
            Allow from all
        </Directory>
    
    </VirtualHost>
    
     
  3. Ovidiu

    Ovidiu Active Member

    I figured out my problem, had nothing to do with ispconfig after all.

    it seems the wordpress built in updater, sets file permissions wrong. Must check what they are set to, but it breaks suPhp somehow.

    If I use plugin central wordpress plugin for updating all seems fine :)
     

Share This Page