.htaccess create behaviour

  • Hi there,


    I´ve got some question concerning .htaccess over web admin panel.


    I´ve tested with two test domains.


    Domain A has several subdomains - one of the subdomains has an existing TYPO3 with its own .htaccess. When I want to secure the folder via web panel I can choose the folder, user etc. and click "protect it" - everything works find BUT where does imscp save the .htaccess file? As there already exists an htaccess file in the htdocs directory, and it is not overwritten, I don´t know where imscp saves the self created htacces? The database doesn´t show anything (table htaccess) except "status ok". (directory is /"subdomain"/htdocs)


    Domain B has some quite unusual behaviour? When adding a protected area I can choose everything and successfully create the protected area - but then for some directories the status is "unexpected error" - the affected directories are the parent directories for the subdomains - is this normal? (example: the subdomain is sub01 - it doesn´t create it for the directory sub01 but for sub01/htdocs).


    Last thing - it is not possible to create ONE .htaccess for the main domain and the subdomains, am I right?


    Thanks in advance
    Simon


    Funny thing:



    Code: /var/log/imscp/Htaccess_module_dvv:6.log
    1. [Fri Oct 9 13:58:28 2015] [debug] iMSCP::EventManager::register: Registering listener on the afterHttpdBuildConfFile event from Servers::httpd::apache_fcgid::_init
    2. [Fri Oct 9 13:58:28 2015] [debug] Modules::Abstract::_runAction: Calling action deleteHtaccess on Servers::httpd
    3. [Fri Oct 9 13:58:28 2015] [debug] iMSCP::Config::_init: Tying /etc/imscp/apache/apache.data
    4. [Fri Oct 9 13:58:28 2015] [debug] iMSCP::Config::_loadConfig: Loading /etc/imscp/apache/apache.data
    5. [Fri Oct 9 13:58:28 2015] [debug] iMSCP::Config::_parseConfig: Parsing /etc/imscp/apache/apache.data
    6. [Fri Oct 9 13:58:28 2015] [debug] iMSCP::File::save: Saving file /var/www/virtual/xxxxx.de/dvv/htdocs/.htaccess
    7. [Fri Oct 9 13:58:28 2015] [debug] iMSCP::File::mode: Changing mode for /var/www/virtual/xxxxx.de/dvv/htdocs/.htaccess to 640
    8. [Fri Oct 9 13:58:28 2015] [debug] iMSCP::File::owner: Changing owner and group for /var/www/virtual/xxxxx.de/dvv/htdocs/.htaccess to 1003:1003

    But the .htaccess is not changed, its still the symlink to the TYPO3 .htaccess file...



    AAAAH, i´ve seen it myself - imscp changes the TYPO3 .htaccess file - it just inserts its own settings - is this okay? Is this done via find and replace?

  • AAAAH, i´ve seen it myself - imscp changes the TYPO3 .htaccess file - it just inserts its own settings - is this okay? Is this done via find and replace?

    Yes it's fine. If an .htaccess-file already exists, it will be used. Otherwise a new one will be created.

  • Hi Ninos,


    thanks for your answer.


    It is possible to secure the whole directory of the domain? So that one don´t has to create an htaccess for every subdomain?


    Regards
    Simon

  • No you need to create for every sub/alias/aliassubdomain an own htaccess..

  • Domain B has some quite unusual behaviour? When adding a protected area I can choose everything and successfully create the protected area - but then for some directories the status is "unexpected error" - the affected directories are the parent directories for the subdomains - is this normal? (example: the subdomain is sub01 - it doesn´t create it for the directory sub01 but for sub01/htdocs).

    @Nuxwin:


    One of my customers did also get this unexpected error.
    The problem was, that the customer wanted to create the Proctected Area (.htaccess) directly in the subdomain directory and not the htdocs of the subdomain.
    But that is not possible, because auf the web folder protection (FS immutable bit).


    Here the error from the log:


    iMSCP::File::getWFileHandle: Unable to open /var/www/virtual/domain.com/dev/.htaccess
    iMSCP::File::save: Unable to save file



    Is it possible to check that in the GUI and do not alow it?

  • Gotta have to ask again - so there is definitely NO WAY to secure the whole directory of the user/domain? It would be great, because one doesn´t have to set the htaccess for every subdomain (as they are not created in the /htdocs directory but in the root of the users www directory).


    Thanks in advance
    Simon

  • Hi Ninos,


    thanks once again. I´ve thought of another way now - I will alter the custom.conf.tpl that way, that the htaccess information will be directly written into the vhost configuration. Now theres one thing...


    AuthUserFile /var/www/virtual/{DOMAIN_NAME}/.htpasswd
    AuthGroupFile /var/www/virtual/{DOMAIN_NAME}/.htgroup


    fits perfectly for the main domain, but what about subdomains? Is there a variable for parent domain? I´m wondering because in the vhost configuration files under /etc/apache2/sites-available/<subdomain>.conf I can see that for <Location /stats>... the authuserfile and authgroupfile directives still point to the directory of the parent domain and not to the subdomain (which is right by design), but how did you achieve that?


    Thanks
    Simon

  • @mrpink


    Just create a ticket.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206