centos 5.1 .htaccess not allowed

Discussion in 'Installation/Configuration' started by happz, Mar 19, 2008.

  1. happz

    happz Member

    Can anyone tell me where to turn on the ability to use .htaccess with centos. I see some info on it else where but it has all been on os's other than centos.

    thanks all....
    happz!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    .htaccess files are allowed on CentOS by Default. Please post the exact error message that you get in the error log of the website.
     
  3. happz

    happz Member

    not sure how to copy the contents of my error log but..

    the error references the .htaccess file not being allow where it is. Where it is would be on the /web/.htaccess...which is where i needs to be but why or what do i need to do? Am i supposed to put the code in the ispconfig admin seciton of the site..under directives?..

    update...here is the error message:
    [Sun Mar 23 13:02:52 2008] [alert] [client 192.168.1.1] /var/www/web4/web/.htaccess: Options not allowed here
    [Sun Mar 23 13:02:52 2008] [alert] [client 192.168.1.1] /var/www/web4/web/.htaccess: Options not allowed here
     
    Last edited: Mar 23, 2008
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Either you put the code in the apache directives field of the site or you change the AllowOverride rule for all websites, which is defined at the end of your apache configuration file.
     
  5. happz

    happz Member

    Okay. I added to directives and that didn't do anything

    This question is to anyone that knows or to Till...

    I found the the apache config file and made the change yet problem is still there. i restarted apache also...here is the .htaccess file:

    RewriteEngine On
    Options +Followsymlinks
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.* - [L,QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^.*/images/(.*)$ /images/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^.*/uploads_user/(.*)$ /uploads_user/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/?$ /profile.php?user=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/blog/([0-9]+)/?$ /blog_entry.php?user=$1&blogentry_id=$2 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/blog/([^/]+)?$ /blog.php?user=$1$2 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/blog/?$ /blog.php?user=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/albums/([0-9]+)/([0-9]+)/?$ /album_file.php?user=$1&album_id=$2&media_id=$3 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/albums/([0-9]+)/?$ /album.php?user=$1&album_id=$2 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/albums/([0-9]+)/([^/]+)?$ /album.php?user=$1&album_id=$2$3 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/albums/?$ /albums.php?user=$1 [L]

    with my VPS i would just drop this in the /www folder and it worked without a hitch. I am guessing the issue is with the / but not sure.

    thanks!
     
    Last edited: Mar 25, 2008
  6. falko

    falko Super Moderator Howtoforge Staff

    Please add this to your Apache Directives field:

    Code:
    <Directory /var/www/web4/web>
    AllowOverride All
    </Directory>
     
  7. happz

    happz Member

    the master! thanks falko!

    Yeap. Saved by falko again...

    thanks!
     
  8. happz

    happz Member

    Question about this directives field add...


    Falko or anyone...my question is can i add this directive to the hosting plan itself rather than to the specified site i.e. (/var/www/web4/web) but instead something like this but in the "hosting plan" section- /var/www/*/web

    Anyone?


    happz
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    If you want to set this for all sites, you can change the definitaion at the end of the apache2.conf file. But be aware that its a security risk to AllowOverride All for all sites and you should not do this if you host any third party sites for clients on your server.
     

Share This Page