Support

Admin Tools

#14222 #14209 – creating .htaccess file in public html directory

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by nicholas on Sunday, 02 December 2012 16:37 CST

elmoshe

Mandatory information about my setup:

Thanks for replying. As you find my question beyond the scope of your support, could you please recommend or refer me to further reading elsewhere? At the moment I have deleted all folders whithin the public_html folder, apart from the joomla installation folder, which resides there among 3 files: the eror-log file, the robots.txt file the current .htaccess file (obviously not a copy of the one generated by Admintools in joomla installation folder).

Regards.

M.E.

nicholas
Akeeba Staff
Manager

Well, the best place to start is reading Apache's mod_rewrite documentation page. Mind you, it's definitely NOT an easy read. It will take a lot of experimentation and fussing around to get results. Google is your friend; whatever you are thinking of doing, somebody else may have already solved.

Regarding security, the error_log shouldn't be web accessible anyway. The robots.txt must be web accessible, so you get to leave it as is. From that point, anythign you might need to add in your .htaccess file in the domain's web root (public_html), usually falls in the "utility" classification. For example:

  • redirecting non-www to www, e.g. example.com redirected to www.example.com
  • redirecting old domain names to the new one, e.g. www.example.org to www.example.com 
  • enabling a particular version of PHP to be used by default (according to your host's instructions)

The first two are widely available solutions if you search for them on Google. The latter one is host-specific.

One thing you should understand about .htaccess files is that they cascade, i.e. the Joomla! site will read both the root (public_html) and the site's (public_html/joomla) .htaccess files. The settings in the latter will override the settings in the former. The combined settings are what will be effective. This is why you can set the default PHP version in the main .htaccess file and be sure that all .php files accessed anywhere on the site will respect that setting.

.htaccess files are incredibly powerful. Remember that with great power comes great responsibility. Always keep copies of your working, tested .htaccess files before making any change. Trust me on that. You'll find out why when the time comes :)

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

elmoshe

Many thanks for your patience.
Done all your recommendations (enabled support for php 5.3 and handled the rediredtions). I found that the .htaccess file was web accessible and overcame this problem by adding the lines:
<Files .htaccess>
order allow,deny
deny from all
</Files>
So now trying to access the file trigers a forbidden page.

Thanks again,
M.E.

nicholas
Akeeba Staff
Manager

Oh, wow, the server allowed access to the .htaccess file?! I didn't see that coming. The default Apache configuration is to decline web access to that file. Good catch!

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!