Support

Admin Tools

#41844 Merging htaccess files

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
5.3
PHP version
8.2.28
Admin Tools version
7.7.1

Latest post by nicholas on Thursday, 17 April 2025 11:39 CDT

jciconsult

The structure of my website uses a subfolder for the joomla site, in this case jdas 4

The top level htaccess is at the top and admin tools creates an htaccess which in jdas4 which I have to disable to avoid redirects.  How do I resolve this?

This is the top level htaccess

RewriteEngine on

RewriteOptions inherit

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 5.9.98.130
deny from 216.244.66.243
deny from 99.226.166.25
deny from 199.71.174.200
deny from 178.255.153.2
deny from 64.237.49.203
deny from 64.120.6.122
deny from 97.107.227.8
deny from 204.152.200.42
deny from 184.154.248.106
deny from 95.211.217.68
deny from 216.244.66.249
deny from 76.72.172.208
deny from 209.126.120.29
deny from 108.163.224.114
deny from 68.180.231.48
deny from 216.244.66.202

deny from 69.175.59.186
deny from 66.249.75.200
deny from 172.97.193.192
deny from 66.249.75.202
deny from 66.249.75.213
deny from 45.55.74.109
deny from 66.249.75.204
deny from 89.163.146.247
deny from 97.107.227.10
deny from 207.244.80.239
deny from 184.154.249.74
deny from 66.249.69.200
deny from 162.218.67.34
deny from 69.165.250.124
deny from 216.59.230.97
deny from 204.187.69.27
deny from 144.76.29.66
deny from 66.249.73.198
deny from 216.209.224.146
RewriteCond %{HTTP_HOST} ^drumbofair\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.drumbofair\.com$
RewriteRule ^/?$ "https\:\/\/www\.drumbofair\.com\/jdas4" [R=301,L]
RewriteCond %{HTTP_HOST} ^drumbofair\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.drumbofair\.com$
RewriteRule ^jdas3\/?$ "https\:\/\/www\.drumbofair\.com\/jdas4" [R=301,L]

nicholas
Akeeba Staff
Manager

The problem is in this part of your .htaccess file:

RewriteCond %{HTTP_HOST} ^drumbofair\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.drumbofair\.com$
RewriteRule ^/?$ "https\:\/\/www\.drumbofair\.com\/jdas4" [R=301,L]

This redirects everything with a rewrite engine relative URL path of / (or empty) to https://www.drumbofair.com/jdas4.

When you have a site in a subdirectory, the .htaccess file (even the one that ships with Joomla; using Admin Tools is irrelevant) needs a RewriteBase for that directory so that all URL rewriting is done relative to the site's root, i.e. you have this line:

RewriteBase /jdas4

Note that if you only have this line and nothing else in our jdas4/.htaccess file you will get the infinite redirection. Why? Because Apache cascades .htaccess file over filesystem directories. It merges the two .htaccess files so your redirection block above is triggered because the path /jdas4 parsed relative to the path /jdas4 is, of course, blank which means that your rule for catching blank paths is triggered. Therefore, you get an infinite redirection loop since /jdas4 redirects back to /jdar4 over and over again.

To prevent that, you need to change your RewriteRule line to:

RewriteRule ^/?$ "https://www.drumbofair.com/jdas4/index.php" [R=301,L]

Also remember to DISABLE "redirect index.php to site's root" in the .htaccess Maker.

This works because the empty path redirect to Joomla's index.php file which, most notably, is NOT an empty path when parsed relative to /jdas4! Therefore, you only get one redirection, breaking the infinite loop.

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!