Support

Admin Tools

#9820 Strange Behavior, HTACCESS?, site/domain settings?

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 Randy Prue on Monday, 11 April 2011 15:58 CDT

Randy Prue
In Joomla 1.5.23 with Admin Tools 2.0.2:

All the Joomla sites I monitor are on the same host, and on that host, the right answer for Forward symlinks is "Yes", so it should be "Yes" for this site too. But as soon as deleted htaccess, got back in and set Follow sym to "No", I could work the back end.

Also unique to this site, the other sites are ALL Joomla. This one is only Joomla in one directory and for maybe 6 pages with a couple dozen images.

Nonetheless, its backup file is 100 MB (55 MB for a full backup on a huge site). This makes me wonder if I have set the site/domain (System Configuration) correctly in htaccess. For HTTPS and HTTP, should I put site.com or site.com/sub-directory?

For base directory of the site, do I put / or do I put /sub-directory (where Joomla is installed)?

Lastly, right now, in Chrome and in Safari, no problems when I go to the main screen of Admin Tools. I see all icons and images.

In Mozilla Firefox, right now, the back-end freezes (I cannot click an icon, select a menu, or log out). On the other machine, I had Firefox open, in Admin. Tools and so I can click the icons but cannot get the back-end menus.

Also, the only icon that loads is the green tick for latest version of Admin Tools. All other graphics do not load.
I am out of ideas here!

nicholas
Akeeba Staff
Manager
Do note that being on the same host is not the same as being on the same server. You might be on servers with slightly different setups. If the affected site is on a server with FollowSymlinks enabled by default and forbids changing it, well, that's why you get the problem.

I don;t understand what you mean that this site isn't all Joomla!? It doesn't matter if there are some static pages and images, as long as you allow full access to all files except PHP to the directory hosting the static HTML and image files.

The backup size does sound a little over the edge, but it can be normal if you have big media files, PDFs, or other download material.

For HTTP/HTTPS URL you should use www.example.com/subdirectory and the base directory should be /subdirectory. That's the exact case we have those fields for in there ;)

On Firefox you seem to be having some JS loading issue. The only graphic that loads seem to be served from your browser's cache instead of the server, so it makes sense that it still displays. All of it seems to be just a matter of some file(s) throwing a 403 error because of the wrong .htaccess setup. It's easy to find out: use Firebug, open its net panel and inspect all items in red. If they have thrown a 403 to you (look at the response headers), remove .htaccess, go to Admin Tools, fix the issue and regenerate the .htaccess file.

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!

Randy Prue
Thanks, Nicholas.

The sites are all on the same server. Related to that, it does seem that FollowSymlinks (Yes) is now working.

The site is many pages, and has been online for a few years. We added /subdirectory and installed Joomla there. There are menu options to enter and exit that Joomla section.

I can get Firebug to load but I cannot (right now) get the back-end menus to work (in Firefox).

I looked at the .htaccess file, and RewriteBase was //subdirectory, so in System Config., I set Base Directory to subdirectory (without the slash).

For HTTP and HTTPS host, I used site.com/subdirectory

I may have to delete the .htaccess, try a few more things (see if I can get Firefox to work so I can look in Firebug).

Randy Prue
Here is another clue: I did get Firefox and Firebug to confess, and mootools.js is throwing a 404, not found. I suppose I have to add that to the exceptions list. Even though media is supposed to pass through and JS is an allowed file type.

What would cause it to not be found? Could it be the www. vs non-www and the redirect?

Addition: The other files that are not found are the graphics for Admin Tools.

Addendum: The files that it wants are /includes/js/joomla.javascript.js
media/com_admintools/images/update-ok-32.png (calls it twice)
media/com_admintools/images/admintools-16.png

nicholas
Akeeba Staff
Manager
OK, now that all makes sense. Go to .htaccess Maker, expand Server Protection and set "Anti-leech protection for static resources outside images/stories" to No, as this rule seems to be broken in Admin Tools 2.0.2. I am going to release version 2.0.3 tomorrow which fixes this issue.

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!

Randy Prue
Thanks! I suspect that 2.0.3 will also include the new .htaccess changes (related to Joomla 1.5.23)?

Yes?

I had decided to leave things quiet until tomorrow's release with the new .htaccess entries, so this works out well.

nicholas
Akeeba Staff
Manager
Yes, today's release will include those (and even more) changes as well. I am not convinced that the performance increase is so dramatic as advertised in the bug tracker, but I decided to give it a try.

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!

Randy Prue
Good [morning, afternoon, evening]:

I see that 2.0.3 is ready, complete with a reminder to write a new .htaccess file.

I tested it first on the small site at /subdirectory

It works much better. There are still some issues, but I am working through them. I think that some have to do with design (template) choices that are no longer appropriate (need to be recoded).

nicholas
Akeeba Staff
Manager
OK! Please let me know if you stumble upon any issues.

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!

Randy Prue
Hello, Nicholas. Yes, there are a few issues. I did the updates, created the new .htaccess file.

Then I began to get some 403 Forbidden. Before I was getting 404s.

The template was made by a designer that I work with. He took one of the standard templates, made a copy, and renamed it. Before we made copies, every time there was an update to the basic template, it would blow away all of our graphics, etc.

So, we have a custom template in its own directory. Maybe in the parameter for List of allowed tmpl= keywords, I need to add something.

I turned off anti-leech protection. I had worked through quite a list of allowing specific files and directories, and some of them still do not load (like mootools). Mootools should be allowed because its directory is allowed, and should pass because I added the file specifically to the direct access lists in Exceptions. It still does not load (according to Firebug and Safari).

The site was mostly loading, mostly working okay, except that any call to /subdirectory caused the site's main home page to load (not /subdirectory/index but site.com/index).

This rendered the entire /subdirectory set-up inaccessible, and the only way to have it load was to turn off anti-leech. That is how it stands now.

Also with anti-leech turned off, in the back-end, I see all the icons for Admin Tools, in its first-loading main page (control panel).

Addendum: Right now, the WAF icons do not show, with a 404 ... media/com_admintools/images (you probably knew that).

Randy Prue
This may have to do with it:

In the firewall, System configuration:

Host name for HTTPS requests (and I used the same for HTTP): www.domain.com/subdirectory

For Base directory of your site: subdirectory

This last one gives me, in .htaccess, for RewriteBase: /subdirectory

If I put /subdirectory, my .htaccess contains //subdirectory, which to me is not correct.

Do I have all of this set properly? I am running out of clues... the behavior is so weird on this one site (the only one with a subdirectory install of the platform (the J one).

To keep the site from not loading, I am living with mootools not loading and admintools graphics not loading.

Also, the WAF configure page loads with all sections opened.

Randy Prue
I don't believe it! I turned off (in .htaccess Maker) the redirect (www. to non-www or vice-versa), and so far, there are now NO problems. I have a lot of features turned off, will turn them on one at a time.

This /subdirectory vs subdirectory question is bugging me still, along with the HTTPS request question. I want to know that I am starting with the right settings.

nicholas
Akeeba Staff
Manager
I am not very sure what you've tried - I've lost track somewhere 2 posts ago :) - so here are the exact settings I have verified are working on a live site placed in a subdirectory:

Redirect www and non-www adresses: Redirect non-www to www
Host name for HTTPS requests (without https://): www.example.com/subdirectory
Host name for HTTP requests (without http://): www.example.com/subdirectory
Base directory of your site (/ for domain's root): subdirectory

All other options turned on. Stock Joomla! 1.5 site with K2, JCE, Admin Tools Professional and Akeeba Backup Professional. Everything working perfectly. Can you use the equivalent settings for your site and let me know if that works for you?

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!

Randy Prue
Thank you, Nicholas.

For the last 3 entries, from Host name to Base directory, yes, that is exactly how I have them set.

Can I conclude that for the redirect, you are always redirecting TO the value in "Host name for..." ?

This setting is causing me grief here. As soon as I use the redirect, I 404s on many of the JS and graphic files for akeeba and for Admin Tools. In Akeeba, I get jQuery and its UI not loaded... cannot determine permissions for com_akeeba (which is 404, so logical conclusion there).

In Admin Tools, I get media/system/js not loading. This is where all the images for Admin Tools back end do not load.

That was redirect www to non-www. (also non-www as the host names in System config. of admin tools.

As soon as I redirect from non-www to www (and this time only, I simultaneously added www. to the Host name setting), the section /subdirectory does not load. The site's main home page loads instead.

So, this is not an option. At the same time, Admin Tools no longer saves. It also displays all the .htaccess sections simultaneously.

I have to delete the .htaccess to get back into the back end. This last problem may be related to how the designer duplicated the front-end menus and design into the Joom design in that one subdirectory. I suspect that it may not comply with J at all.

nicholas
Akeeba Staff
Manager
Randy, when you enable the non-www to www redirection, that's exactly what happens: all requests to example.com are redirected to www.example.com, keeping their subdirectory and query string information. Try this by visiting http://akeebabackup.com/documentation.html - see how the www. got added and the directory was kept?

Now, regarding the 404s, do you have a live_site setting in your configuration.php file? If you do, edit it and make it read

var $live_site = '';

in order to let Joomla! figure it out. Does this help?

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!

slaes
sounds like have have some configuration issues here.

this post seems quiet messy and i'm also lost some posts ago. However i believe im aware of what your doing wrong.

So lets start again.

So simply website A is http://www.websiteA.com Website A and has its own joomla install and .htaccess file WHICH REDIRECTS non www to www. Assuming website A also has it Live Site Variable within the config.php file set to excactly to 'http://www.websiteA.com' and the hosts names within admin tools is set to exactly www.websiteA.com and the root folder exactly to / then website A is setup correctly and has no problems.

Next onto website B.

1. Website be is a complete installation located within a subfolder of website A. eg www.websiteA/websiteB. Website B has its own .htaccess file and is whats causing you problems due to misconfiguration.

2. First the config.php file within website B, live site variable MUST be set to exactly 'http://www.websiteA/websiteB'

3. If your try to set the .htaccess file within website B to redirect from non www to www you need to carefully think about whats going on here. Assuming you are then you need to take the following steps.

4. Within the .htaccess maker of website b (if you cant access it delete the .htaccess file for website b and MAKE sure you are accessing the administrator section of website B as follows www.websiteA.com/websiteB/administrator, if you exclude the WWW, this will not work due to website A's htccess file. Once in, set redirect non www to www and MAKE SURE you set HOST NAMES EXACTLY AS FOLLOWS www.websiteA.com/websiteB

5. Base Directory of sites root. This must be set as /websiteB (this is exactly the foldername and root path to website B.

NOTE: you will only ever be able to access website B as follows : www.websiteA/websiteB. It will not work without the www and will not automatically redirect you to website B.

Follow exactlty the above and and everything will work 100%. Miss 1 thing / step or a / in the wrong place and it will all break.

IMHO opinion assuming that Website B will one day become it own site with its own Cpanel account this entire process is very obscure as you will need to redo the whole thing again. If your developing a website under a subfolder of an excisting site, thats fine and common practice. However the .htaccess file should be the last thing you do and as its own account.

If on the other hand your running 1 cpanel account and pointing addon domains to subdirectories (hence needing the .htaccess file within each subdirectory) as live sites, i think in terms of security, your playing with fire.

I have put some effort into this and if followed 100% will fix your issues.

Thanks mate.

Randy Prue
Thanks to both of you!

From the beginning, the configuration.php file does contain var $live_site... exactly as you recommend that it be set.

siteA.com is NOT a Joomla site. siteA.com/siteB.com IS a Joomla site.

So siteA uses JS menus that have nothing to do with Joomla.

siteB SOMEHOW uses these non-Joomla menus (only the designer knows how he made this work). My menus act up when I am in Site B.

The menus DO NOT drop down when in Site B.

As soon as I click any menu (while in B) that leads to Site A, then I return to Site A (looks the same) but the drop-down menus commence to work again.

So, visitor, while in Site B, if he keeps choosing Site B pages (there are only 3 pages), just wanders around Site B until he clicks a Site A choice, and then the onlyl difference they see is that menus drop down again.
Thus I think that the problems may be caused by my designer's menu hacking. The logic of what each of you suggests is flawless and perfect, and so I think the problem is outside of anything that I can configure.

I would have to get my guy to redo the menus or have my customer pay for an entire Joomla site.

Randy Prue
2. First the config.php file within website B, live site variable MUST be set to exactly 'http://www.websiteA/websiteB'

When I do this, I lose the entire template (all graphics). I cannot leave the site like this, even long enough to troubleshoot, so the site path was removed immediately. I will give it one more shot without the www.

The result is the same... template gone.

Randy Prue
For Base Directory as /SiteB, if you check inside the .htaccess file, you will see that this generates a variable of //SiteB, so I used Nicholas' recommendation of SiteB for the variable.

This seems to work better (as in it produces the variable as /SiteB within the .htaccess file.

So, without some new idea, I think this is a dead end.

slaes
Randy, i really want to help you on this one however im not sure how much more can be done dude.

1. Does Website A, have a .htaccess redirect in place? non-www to www?

2. If it does Website B must reflect that as its its a sub directory of website A.

for eaxmple if website A redirects non www to www, your live site variable and htaccess files in website be MUST BE www.websiteA/websiteB

3. Man, please take my advice and setup this Website B as its own cpanel account, rather than an addon domain, save yourself all the issues.



Randy Prue
Slaes, thank you!

Site A does not use a .htaccess file.

I am trying to think of how to give Site B its own cpanel.

Customers go to SiteA.com, click a menu that takes them to SiteB (in a subdirectory).

The domain is the same.

I am trying to think of how I could register a new "domain" or cpanel account with only one domain name registration. I am a "reseller" so I can set up the new cpanel account, as long as I can make it unique, and as long as visitors always go to SiteA.com (the name of the company), and as long as SiteB.com can link back to SiteA by a simple menu choice.

To the visitor, they have never left the company's site. The change is transparent.

slaes
yeah thats cool, your on the right track.

Out of curiosity, why do you have 2 different sites, both for the same customer acting on 1 domain as 1 site, linking with menu items? This is a nightmare man.

You need to either make it one site or remove the htaccess file for site B, however i suspect your going to have other issues as AT is not the only thing which looks to root paths and etc.

Your cant have a seperate cpanel account if you plan on using the same domain name for Site A and B.

If i were you, i would scrap site A, make site B the new site A and work everything around that.

Alternatively you get another domain name for site B, and url link between the Site A and B. However i would not consider this ideal at all.

Randy Prue
Thanks, Slaes. If I made Site B the whole thing, I will spend days and dollars to do it. Since the customer has not asked for it, I will be subsidizing it myself.

Two domain names is more feasible. I could make it work. At least I would know how to set it up.

The customer wanted to TEST a small interactive section to see if they like it, before they make the whole site CMS.

slaes
yeah Randy, its the only proper way to do it, especially since website A is not joomla. It's possible however will cause you grief like you would not believe, and it'll be constant.

If website B is a separate domain and simply url links with website A and vice versa, you'll be sweet. And remember you'll only be responsible for website B. If Your client wont do things properly and rebuild 1 site around the whole thing, and shit hits the fan with website A, it wont be your responsibility.

Good luck bro.

Randy Prue
Thanks, Slaes. There may be a solution in there.

The customer is very good. They will go for any solution that I can justify.

Randy Prue
Back again. A friend of mine runs UNIX servers for a big web company. I explained the problem with the 2 sites and the templates not loading.

He suggests .htaccess at the root (let it recurse), with suPHP and the path to the site (so that everything can find the templates?).

Then he suggests php.ini in the root with register globals.

Does this make any sense to anybody? I would not want to do that without him sitting here (he offered to help, so this might happen one evening).

nicholas
Akeeba Staff
Manager
Register globals set to on?! GOD FORBID! Where was that friend of yours the last ten years? Under a rock or something? Registering globals is a security "mortal sin". I wouldn't trust your friend being anywhere near any of my sites.

Regarding his .htaccess advice, um, not necessary. Whereas it is possible to have a .htaccess in the web root and let it recurse, it can work perfectly from a subdirectory because -he should know that if he's managing UNIX servers- the directives in the .htaccess file in the subdirectory overrides the same directives in the .htaccess file in the web root.

BTW, the advice your friend gave you were valid back in the early 00's, when PHP4 was in its infancy and web software was nowhere near as complex or sophisticated as today. This advice is simply out of place when you're talking about Joomla! 1.5 or later.

Anyway, your problem is not the .htaccess file, it's the funky things the designer tried to do as you told yourself. Apparently, the designer had no idea how Joomla! works, created a menu the "Dreamweaver way" (everything hard-coded), referencing JS files outside of the Joomla! root, ergo the problem. The only way to work around that would be removing the RewriteBase in the .htaccess, but that might kill SEF URLs and the server protection on the Joomla! site. The proper fix is to get rid of the hardcoded menu and create a proper Joomla! menu on the Joomla! site.

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!

Randy Prue
Thank you, Nicholas. That is good to know about my server buddy.

For the menus, I have put in a request for "management" to encourage the designer to have another shot at his work.

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!