Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: htaccess in a folder

  1. #1
    Join Date
    Jun 2008
    Location
    Canada
    Posts
    436

    Default htaccess in a folder

    hi

    in

    /srv/www/htdocs/tale

    i have a .htaccess

    how to enable it?

    i don't changed anything in

    Code:
    /etc/apache2/httpd.conf
    /etc/apache2/default-server.conf
    thanks

  2. #2
    tom NNTP User

    Default Re: htaccess in a folder

    collinm wrote:

    >
    > hi

    I have this in my httpd.conf:

    # use .htaccess files for overriding,
    AccessFileName .htaccess
    # and never show them
    <Files ~ "^\.ht">
        Order allow,deny
        Deny from all
    </Files>

    It seems to work well enough. But, httpd.conf calls on default-
    server.conf, so it should also work if you put it in there instead and
    the statement to include default-server.conf isn't commented out.
    There are other ways as well of accomplishing what htaccess does, but
    for some tasks, htaccess is just simpler to use.

    >
    > in
    >
    > /srv/www/htdocs/tale
    >
    > i have a .htaccess
    >
    > how to enable it?
    >
    > i don't changed anything in
    >
    >
    > Code:
    > --------------------
    >
    > /etc/apache2/httpd.conf
    > /etc/apache2/default-server.conf
    >
    > --------------------
    >
    >
    > thanks
    >
    >



  3. #3
    Join Date
    Jun 2008
    Location
    Canada
    Posts
    436

    Default Re: htaccess in a folder

    a part of my /etc/apache2/httpd.conf


    Code:
    <Directory />
        Options None
        AllowOverride None
        Order deny,allow
        Deny from all
    </Directory>
    
    AccessFileName .htaccess
    # and never show them
    <Files ~ "^\.ht">
        Order allow,deny
        Deny from all
    </Files>

    a part of my /etc/apache2/default-server.conf

    Code:
    <Directory "/srv/www/htdocs">
            # Possible values for the Options directive are "None", "All",
            # or any combination of:
            #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
            #
            # Note that "MultiViews" must be named *explicitly* --- "Options All"
            # doesn't give it to you.
            #
            # The Options directive is both complicated and important.  Please see
            # http://httpd.apache.org/docs-2.2/mod/core.html#options
            # for more information.
            Options None
            # AllowOverride controls what directives may be placed in .htaccess files.
            # It can be "All", "None", or any combination of the keywords:
            #   Options FileInfo AuthConfig Limit
            AllowOverride None
            # Controls who can get stuff from this server.
            Order allow,deny
            Allow from all
    </Directory>
    it's the default opensuse value...because i don't changed theses file

    my htaccess file - /srv/www/htdocs/thelia
    Code:
    Options +FollowSymlinks
    RewriteEngine on
    
    #CONTENU
    #############
    RewriteRule   ^([a-z0-9-]*)__([0-9]*)_([a-z0-9-]*)_([0-9]*)\.html  contenu.php?id_contenu=$4  [NC,QSA,L]
    
    #RUBRIQUE
    ##############
    
    RewriteRule   ^([a-z0-9-]*)_([0-9]*)_([a-z0-9-]*)_([a-z0-9-]*)_\.html  rubrique.php?id_rubrique=$2  [NC,QSA,L]
    RewriteRule   ^([a-z0-9-]*)_([0-9]*)_([a-z0-9-]*)_\.html  rubrique.php?id_rubrique=$2  [NC,QSA,L]
    RewriteRule   ^([a-z0-9-]*)_([0-9]*)_\.html  rubrique.php?id_rubrique=$2  [NC,QSA,L]
    
    
    #PRODUIT
    #############
    RewriteRule   ^([a-z0-9-]*)_([0-9]*)_([a-z0-9-]*)_([a-z0-9-]*)__([^.]*)\.html  produit.php?ref=$5&id_rubrique=$2  [NC,QSA,L]
    RewriteRule   ^([a-z0-9-]*)_([0-9]*)_([a-z0-9-]*)__([^.]*)\.html  produit.php?ref=$4&id_rubrique=$2  [NC,QSA,L]
    RewriteRule   ^([a-z0-9-]*)_([0-9]*)__([^.]*)\.html  produit.php?ref=$3&id_rubrique=$2  [NC,QSA,L]
    if i put my htaccess file in /srv/www/htdocs/thelia

    i get:

    Code:
    Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

    any idea?

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: htaccess in a folder

    a2enmod rewrite
    rcapache2 restart

  5. #5
    Join Date
    Jun 2008
    Location
    Canada
    Posts
    436

    Default Re: htaccess in a folder

    ok now i get:

    Code:
    [Sun Aug 09 16:15:07 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
    [Sun Aug 09 16:15:07 2009] [notice] Apache/2.2.10 (Linux/SUSE) mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.9 with Suhosin-Patch configured -- resuming normal operations
    [Sun Aug 09 16:15:43 2009] [error] [client 127.0.0.1] File does not exist: /srv/www/htdocs/thelia/sac-a-dos_19_touring_asolo-encounter__asoloencounter60.html, referer: http://localhost/thelia/produit.php?ref=ASOLOENCOUNTER60&id_rubrique=19

  6. #6
    Join Date
    Jun 2008
    Location
    Canada
    Posts
    436

    Default Re: htaccess in a folder

    any idea?

    is it the htaccess who is the problem?

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: htaccess in a folder

    If you want .htaccess to work you must allow override for the thelia directory, otherwise it ignores the directives inside it.

  8. #8
    Join Date
    Jul 2008
    Location
    Angel Fire, NM USA
    Posts
    330

    Default Re: htaccess in a folder

    Quote Originally Posted by ken_yap View Post
    If you want .htaccess to work you must allow override for the thelia directory, otherwise it ignores the directives inside it.
    Which conf file needs AllowOverride All in order to process .htaccess fiels in users public_html and sub folders ?

  9. #9
    Join Date
    Jul 2008
    Location
    Angel Fire, NM USA
    Posts
    330

    Default Re: htaccess in a folder

    Hope someone can confirm I have done this the correct way!

    I edited /etc/apache2/mod_userdir.conf and changed

    AllowOverride All
    Options All

    Now I do not get Internal Serrver Errors when I have a .htaccess file in my user/public_html directories

    ???
    Thanks

  10. #10
    Join Date
    Mar 2009
    Location
    sri mayapur, west bengal, india
    Posts
    958

    Default Re: htaccess in a folder

    EDIT: The text below NOT true. Please see the next post where this post is corrected

    On Tue, 22 Feb 2011 22:36:03 +0530, Ski K2
    <Ski_K2@no-mx.forums.opensuse.org> wrote:

    >
    > Hope someone can confirm I have done this the correct way!
    >
    > I edited /etc/apache2/mod_userdir.conf and changed
    >
    > AllowOverride All
    > Options All
    >
    > Now I do not get Internal Serrver Errors when I have a .htaccess file
    > in my user/public_html directories



    i'm afraid that, depending on your apache2 configuration, this won't work.
    i suspect you're not getting an error because that file, mod_userdir.conf,
    isn't pulled into the standard config file (/etc/apache2/httpd.conf) --
    this option is commented out. i also don't think that this is what
    mod_userdir.conf is supposed to do.

    if you want to set that option, to allow .htaccess to modify permissions,
    server-wide i would set it directly in httpd.conf, where it says:

    Code:
    <Directory />
    Options None
    AllowOverride None
    Order deny,allow
    Deny from all
    </Directory>
    changing "AllowOverride None" to "AllowOverride All", or whatever
    permissions you want to allow.

    otherwise, if you have enabled different virtual hosts, in
    /etc/apache2/vhosts.d/<your-virtual-server>.conf

    --
    phani.

    EDIT: The above is NOT true. Please see the next post where this post is corrected
    Last edited by hcvv; 22-Feb-2011 at 12:47. Reason: Request from the poster to forget about this post

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •