Greetings all, I am sorry if this is not the right forum for this question. I wasn't sure so feel free to move it if necessary. We are having random issues where our web site has elements that are not being rendered correctly across different browsers.
Sometimes you can load a page and an element like a <span> tag will be in an unusual place or not have its CSS applied to it at all. Doing a refresh of the page seems to correct the issue and from that point it is fine.
I wanted to see if there might be some apache configuration setting to look at to help ensure that visitors see the correct page layout the first time, or be pointed in any direction to help me figure this out.
As it is random it is a bit difficult (for me) at this point to try tracking this issue down. The issue does NOT appear on everyone visiting the page for the first time, even with the same browser.
Immediate response: It sounds like a rewrite issue, where the user's browser thinks you are in one location and you're really somewhere else.
But I'm confused about the seemingly contradictory lines
our web site has elements that are not being rendered correctly across different browsers
The issue does NOT appear on everyone visiting the page for the first time, even with the same browser.
this is not a cross-browser issue. The same browser can look just fine on one machine but on another have the issue and need refreshing.
Does it always end up displaying as intended? I've deliberately said "as intended" rather than "correctly" because most apache/rewrite problems are due to the computer doing exactly what you told it to do, which may not be what you wanted it to do ;)
Do you have a great big long htaccess file that has been changed and added-to by a string of different people, possibly starting with CMS boilerplate?
Thanks for the response Lucy. The answer is no, it does not always display as intended. However the issues we have seem to be somewhat random where one computer may see the issue and another will not.
Yes, our htaccess file is quite large, mostly dealing with rewrites pertaining to structural changes within joomla such as individual page redirects where we have recategorized products and expanded categories into subcategories etc...
It is probably best to start with htaccess cleanup. Some general principles:
# annotate each rule (or group of closely related rules)
Leave a blank line after each Rule.
Dump anything that says <IfModule ... Not the code between the if and endif, just the lines themselves. You either have a given module or you don't, and should code accordingly. But keep the material for each module together.
If you have both RewriteRule and Redirect (by that name), change the Redirects (mod_alias) to Rewrites (mod_rewrite).
Any rule that ends in [F] or [G] should go at the beginning. And then move from most specific (named pages or groups of pages) to least specific (with-or-without www redirects).
Put all external redirects (the ones with a full http://example.com and [R=301]) before all internal rewrites.
Include the [L] flag at the end of each RewriteRule unless you have a clear and specific rule for omitting it. It's redundant with some flags like [F] but will do no harm.
Now sit back and look at the htaccess and the issues should start jumping out at you.