It is currently Fri Dec 05, 2008 1:29 pm (All times are UTC )

 





Post new topic Reply to topic  [ 16 posts ] 
Author Message
Posted: Fri Dec 02, 2005 5:16 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Wed Aug 17, 2005 11:26 pm
Posts: 869
Currently $mosConfig_live_site gets picked up in the basic SEF as base href.

It's in includes\frontend.php and may be in other code as well.

if ( isset($mosConfig_sef) && $mosConfig_sef ) {
echo "\r\n";
}

The problem with this is that it forces sites into chosing to be either www or NO-www but not giving the option to be both.
Where Apache is set up for a domain with an alias to handle the url as either http://domain.com or http://www.domain.com, using $mosConfig_live_site is effectively hardcoding the url into being one or the other. 

Now, the www subdomain is deprecated (and the sooner everyone drops it the better!) but many visitors hold with the old ways and look for a domain under the www subdomain.  Until everyone stops doing this, sites have to make allowances for it.  But, a visitor should be able to navigate the entire site following the same path. 
If $mosConfig_live_site is set to domain.com and a visitor comes in through http://www.domain.com, dynamic links will throw them onto the NO-www path.  Ok, they are still on the site and seeing what they need.  Search engines, however, see this as moving from one site to another and will penalise sites for this.

I know that the argument is that everyone should just set $mosConfig_live_site to use www - but I have an issue with using something that is deprecated and unneccessary. 

A simple fix is to use $_SERVER['HTTP_HOST']

So, my request is this : could $mosConfig_live_site be changed/removed and $_SERVER['HTTP_HOST']  used instead?

I am not a coder, so I may be simplifying the change needed.  But after spending hours reading the Joomla code to find why my site is moving between www and NO-www, getting extra hits on Apache for its troubles, and getting penalised by Google for it, this is what I have pinpointed as being the problem.

Can this be fixed for the new release please?

_________________
For Mambo assistance: http://forum.mambo-foundation.org
Open Source Research & Best Practice: http://osprojects.info


Top
  E-mail  
 
Posted: Fri Dec 02, 2005 7:42 am 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Thu Aug 25, 2005 5:48 pm
Posts: 2792
Location: Geneva mostly
Also, when I browse, I tend to simply enter the site name, and hit ctrl + enter (Win/IE) to get http://www. sitename .com automatically, so not using www is not an option as long as IE works like this (and NO, I'm not going to use FF as primary browser :) ).
Good suggestion (I think, also not being a coder really..) and: even better to see you around, Elpie!

_________________
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.blogspot.com for J! 1.5 screenshots
http://www.eyezberg.com


Top
  E-mail  
 
Posted: Fri Dec 02, 2005 8:13 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri Aug 26, 2005 11:09 am
Posts: 182
Yes, there definitely needs to be some solution to this, it is a bit of a pain.

Glad to see you back, Elpie.


Top
  E-mail  
 
Posted: Fri Dec 02, 2005 10:03 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Wed Aug 17, 2005 11:26 pm
Posts: 869
Thanks guys - I am not exactly back ;)

I just spent so long searching thru code after having a sys admin spend ages trying to find whether my server set-up was causing the problems, that having found it I thought it churlish not to alert the devs to the issue. 
Figured that if it was a problem to me it may well be a problem for others too ;)

Logic tells me that putting this into config should fix that problem, but I am not a coder and dont have a clue whether anything else would be adversely affected (and not about to try it on a live site - call me chicken!):

$mosConfig_live_site = $_SERVER['HTTP_HOST'];

Would it break anything?  Anyone game to try it out?  If it does work then it makes sense to set it in concrete in configuration.php except that it may then restrict local development on some systems.

_________________
For Mambo assistance: http://forum.mambo-foundation.org
Open Source Research & Best Practice: http://osprojects.info


Last edited by Elpie on Fri Dec 02, 2005 10:05 am, edited 1 time in total.

Top
  E-mail  
 
Posted: Fri Dec 02, 2005 11:50 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Wed Aug 17, 2005 11:26 pm
Posts: 869
Update:
Took the plunge and tried changing the live_site in configuration.php to this:

$mosConfig_live_site = $_SERVER['HTTP_HOST'];

I can now report that the live site I tried it on ended up with no template, css or images :D

It's a brilliant way to test how accessible the site is  ;)  Don't recommend others try it tho'.

_________________
For Mambo assistance: http://forum.mambo-foundation.org
Open Source Research & Best Practice: http://osprojects.info


Top
  E-mail  
 
Posted: Fri Dec 02, 2005 3:32 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Thu Aug 25, 2005 5:48 pm
Posts: 2792
Location: Geneva mostly
@ avatar: I thought Felix was a cat, not a kitten..? ;) Mine's smilyng at least.. :D
Thanks for trying, I guess one of the devs will find a suitable alternative.

_________________
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.blogspot.com for J! 1.5 screenshots
http://www.eyezberg.com


Top
  E-mail  
 
Posted: Fri Dec 02, 2005 7:04 pm 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Fri Aug 19, 2005 12:14 am
Posts: 1145
Location: United Kingdom
Elpie wrote:
Thanks guys - I am not exactly back ;)


A little bit is better than nothing.

_________________
http://www.jomres.net The bookings component
Life is not a journey to the grave with the intention of arriving safely in one pretty and well preserved piece, but to skid across the line broadside, thoroughly used up, worn out, leaking oil, yellng GERONIMO


Top
   
 
Posted: Fri Dec 02, 2005 7:33 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Fri Aug 12, 2005 12:38 am
Posts: 9469
Location: Sydney - Australia
Have you tried: http://".$_SERVER['SERVER_NAME'] ?

_________________
Brad Baker
http://www.rochen.com - Joomla! Hosting, the correct way.
http://www.joomlatutorials.com <-- Joomla! 1.5 & 1.0.x
..somewhere in this hospital the anguished oink of a pig man cries out for help..


Top
  E-mail  
 
Posted: Tue Dec 13, 2005 11:40 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Wed Aug 17, 2005 11:26 pm
Posts: 869
I have tested the following out in a couple of sites and it works. 

Code:
$mosConfig_live_site = 'http://'. $_SERVER['HTTP_HOST'];


I intend to make this change in every Mambo and Joomla site I control.  It returns the correct base href and keeps visitors on the url on which they enter, so www stays www and NO-www stays without it.

I feel that this is a much better way to handle $mosConfig_live_site because, apart from anything else, it respects the way the server has been set up and allows the aliasing to work. 

I would like to see this become the default, "out of the box" setting however while I know it works like a charm on Linux/UNIX based servers, I don't know what the implications are for Windows servers. 

_________________
For Mambo assistance: http://forum.mambo-foundation.org
Open Source Research & Best Practice: http://osprojects.info


Top
  E-mail  
 
Posted: Tue Dec 13, 2005 11:54 am 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Wed Aug 17, 2005 11:03 pm
Posts: 1346
Location: New Orleans, Louisiana
Good idea...

Louis

_________________
Development Working Group Coordinator
http://webimagery.net - Consulting
http://jxtended.com - Solutions for Joomla! 1.5
A hacker does for love what others would not do for money.


Top
  E-mail  
 
Posted: Tue Dec 13, 2005 8:56 pm 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso
Offline

Joined: Fri Sep 16, 2005 8:41 pm
Posts: 3612
Location: NRW - Germany
Elpie wrote:
Code:
$mosConfig_live_site = 'http://'. $_SERVER['HTTP_HOST'];


Setting http as static would (in my opinion) prevent https to be used. Or do I miss something? You would have to see which protocol has been called.

Hackwar

_________________
god doesn't play dice with the universe. not after that drunken night with the devil where he lost classical mechanics in a game of craps.

Since the creation of the Internet, the Earth's rotation has been fueled, primarily, by the collective spinning of English teachers in their graves.


Top
   
 
Posted: Tue Dec 13, 2005 11:22 pm 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Wed Aug 17, 2005 11:26 pm
Posts: 869
I'm not sure where/how https is called in the script if users dont want their entire site to run under SSL, as http is there in $mosConfig_live_site anyway, regardless of whether $mosConfig_live_site = 'http://'. $_SERVER['HTTP_HOST'];  is used or $mosConfig_live_site = 'http://yourdomain'; (the usual way its entered) .

There are a number of hacks that have been discussed about how to enable SSL on the backend without having to make an entire site run under https (which is the case if $mosConfig_live_site = 'https://yourdomain'; ). I understand that this is being addressed in 1.1.

The only difference my change makes is that it takes the domain name from the server instead of harcoding it into the config.  Most servers these days are set up to allow aliasing from domainname.com to http://www.domainname.com, which enables visitors to come in through either the www of NO-www path.  Using HTTP_HOST allows that to continue and when SEF is enabled it dynamically sets base href as either www or NO-www, depending on how the visitor has come onto the site. 

Nobody ever knows how a visitor is going to access a site. For sites that don't use www, they will still have people who come in trying to use it and many who link to the site will create links using www in the url.  Until everyone wakes up to the fact that www is deprecated and unneccessary anyway, allowances have to be made for this. 

Rey said back in September that SSL handling would be in 1.1:
Quote:
it is a setting that will be configirable via the admin panel and set for individual menu items if necessary.
so I hope this is still the plan for 1.1 ;)

_________________
For Mambo assistance: http://forum.mambo-foundation.org
Open Source Research & Best Practice: http://osprojects.info


Last edited by Elpie on Tue Dec 13, 2005 11:25 pm, edited 1 time in total.

Top
  E-mail  
 
Posted: Tue Dec 13, 2005 11:29 pm 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Wed Aug 17, 2005 11:03 pm
Posts: 1346
Location: New Orleans, Louisiana
Not so much "in the plan" as it is "in the source tree" :)

Your suggestion on the $_SERVER['HTTP_HOST'] is a good one.... looking into how to combine this with the current SSL switching mechanism

Louis

_________________
Development Working Group Coordinator
http://webimagery.net - Consulting
http://jxtended.com - Solutions for Joomla! 1.5
A hacker does for love what others would not do for money.


Top
  E-mail  
 
Posted: Tue Dec 13, 2005 11:36 pm 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Wed Aug 17, 2005 11:26 pm
Posts: 869
That is really good news Louis :)
Thanks

_________________
For Mambo assistance: http://forum.mambo-foundation.org
Open Source Research & Best Practice: http://osprojects.info


Top
  E-mail  
 
Posted: Wed Jan 18, 2006 1:58 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Wed Jan 04, 2006 10:08 pm
Posts: 408
Just to be sure
are you saying that change be aplyed to the configuration.php file ? only
If so it seems i just tested it on
an apache 2 running on windows xp and seems to run fine.
Just SEF creating seems seems a little slow about 1 sec behind
Will run a stress test lata from difrent machines and see

_________________
| Become a Certified L.S.P  User Today | LINK the sites concerning the issues | SEARCH the forums first to find the answers | POST your questions with clear titles |


Top
   
 
Posted: Tue Dec 04, 2007 3:46 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Dec 04, 2007 3:39 pm
Posts: 1
Hey guys just got on here. I am having problems with this.

I changed my config file to $mosConfig_live_site = 'http://'. $_SERVER['HTTP_HOST'];

However when you save your configuration in the CMS it changes this back to the way it was. I was thinking we need to change something in "/administrator/components/com_config/admin.config.php    so the hacks would stay saved in the configuration.php file.


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group