The MU forums have moved to WordPress.org

Adding www to WordPress URL (32 posts)

  1. lucipublishing
    Member
    Posted 16 years ago #

    Hey everyone! I have a client that wants the "www" added to his URL, any ideas on how I can get this done?

    I would appreciate anyones info.

    Thanks!

  2. drmiketemp
    Member
    Posted 16 years ago #

    Some specifics on your setup would be helpful. Is this client an end user or are they the site admin? Are you using subdomains or subdirectories on this wpmu? Is this for a specific blog within wpmu or for all of them? What specific version of wpmu are you running? (The code got changed in there on how the 'www' get handled.)

    edit: Is this for WordPress or WordPress Multiuser? I note that you say 'wordpress'. Regular wordpress is over at http://wordpress.org

  3. lucipublishing
    Member
    Posted 16 years ago #

    They client is the site admin. I am using WordPress-Mu-1[1].2.3 I am using the sub directory: http://www.mysite.com/blog setup, And yes it is for multiusers. Can you help?

  4. drmiketemp
    Member
    Posted 16 years ago #

    - Delete lines 233 and 234 out of index-install.php:

    if( substr( $_SERVER[ 'HTTP_HOST' ], 0, 4 ) == 'www.' )
    $hostname = str_replace( "www.", "", $_SERVER[ 'HTTP_HOST' ] );

    edit: That's the bit that forces the removal of the 'www' To my knowledge, that no longer appears anywhere else within the code. (It used to though.)

    - During setup when the software asks for the Server Address, make sure you put the 'www' bit in there. (ie http://www.mywpmuinstall.tld)

    - You're also going to have create a htaccess rule where if someone tried to access your site without the 'www' bit rollsover to the URL with the 'www' bit.

    Do realize that forcing the 'www' is incorrect and technically against the RFCs though. I would mention that to your client just for future reference and for butt covering.

    Hope this helps,
    -drmike

  5. lucipublishing
    Member
    Posted 16 years ago #

    Thanks drmike

  6. drmiketemp
    Member
    Posted 16 years ago #

    Not a problem. I hope it works. :)

  7. lucipublishing
    Member
    Posted 16 years ago #

    Just out of curiosity, should I comment out the function $nowww ?

  8. drmiketemp
    Member
    Posted 16 years ago #

    Where are you seeing that? That's part of the code that got removed I believe.

  9. lucipublishing
    Member
    Posted 16 years ago #

    It's in the index-install.php file, line 406 & 407

  10. drmiketemp
    Member
    Posted 16 years ago #

    You better just to be on the safe side. Sorry about that. I'd just comment out the function call.

    edit: It looks like that if you add the 'www' in there, it will reload the page telling you the 'www' is incorrect and asking you to continue.

    reedit: What's really bad is that's the name of the function that did it previously. I swear I search for it....

  11. lucipublishing
    Member
    Posted 16 years ago #

    Ok, so far nothing has worked ... I have tried comenting out lines, trying to hard code it in ... Is there anyone out there that can make this happen for me? My client refuses to not have the "www" included in his URL.

  12. drmiketemp
    Member
    Posted 16 years ago #

    Did you add in a rewrite rule into htaccess after installing?

    What specificially is the issue that it's not working? Is it not rolling over to the 'www'? Is it not installing?

  13. lucipublishing
    Member
    Posted 16 years ago #

    The blog is installed at http://www.student-loans.net/blog

    The owner of this site wants every URL link to include "www" It doesn't matter that everyone else recommends that he not do it, he's the owner and I have to do what he says.

    I just need to have the thing have www in every URL.

  14. drmiketemp
    Member
    Posted 16 years ago #

    Go into your wp_site mysql table and add in the www bit to the first (and probably only) record in there. Create a new blog and see if the 'www' bit sticks.

  15. lucipublishing
    Member
    Posted 16 years ago #

    I got it, I just hard coded the links.

  16. kchrist
    Member
    Posted 16 years ago #

    Drmike:

    Do realize that forcing the 'www' is incorrect and technically against the RFCs though.

    This is nonsense. In searching these forums for something similar I've noticed that you assert this in other threads as well. There is absolutely no reason whatsoever that web sites should not begin with "www.", "wwwww.", or "wtf." if the owner so chooses.

    I'd be very interested in seeing this RFC you're talking about. Thanks.

  17. lunabyte
    Member
    Posted 16 years ago #

    Then google it.

  18. kchrist
    Member
    Posted 16 years ago #

    Way to miss the point. This "RFC" does not exist.

  19. lunabyte
    Member
    Posted 16 years ago #

    You asked to see it, I said Google it. If it doesn't exist, it doesn't exist.

    How that is missing the point, when there wasn't one is beyond me.

    But hey, thanks for playing the game.

  20. lunabyte
    Member
    Posted 16 years ago #

    Oh, and while we're at it, I believe the one in question is requiring the server to answer to the domain. Meaning example.com. Then again, RFC's are like web standards. Most people are idiots when it comes to them, and flat out don't care.

  21. Vimm
    Member
    Posted 16 years ago #

    Can't resist.

    http://www.hm2k.com/articles/yes-www

    I'd reference http://www.yes-www.org but it seems to be down right now.

    Also, I believe the statement by kchrist about wanting to see the RFC was rhetorical, as I think we all know it does not exist.

    Only reason I care is because I was required to install this on a server starting with "www.". I posted somewhere what code I commented to make it work but I could post a .patch file if anyone's interested. Judging by the couple e-mails I got before it was finished there is interest.

  22. kchrist
    Member
    Posted 16 years ago #

    Lunabyte:

    I believe the one in question is requiring the server to answer to the domain. Meaning example.com.

    Well, that's interesting because, to the best of my knowledge, there's no requirement that a second-level domain have an A record either. So it's perfectly legal that http://www.example.org will resolve and example.org will not, which is another reason that enforcing that in WPMU is a bad idea. The main reason, of course, is that forcing one's opinion on others who may not share it is not a very good way to get people feeling good about your software. Especially if this enforcement causes the product to not work for the desired purpose.

    Vimm: That may have been your post then about the two lines to comment out in wpmu-settings.php. If so, thanks.

  23. ekusteve
    Member
    Posted 16 years ago #

    I'd reference http://www.yes-www.org but it seems to be down right now.

    Vimm: Maybe they changed it to yes-www.org ;-)

    Thanks for the http://www.hm2k.com/articles/yes-www link...good info.

    Steve

  24. MrBrian
    Member
    Posted 15 years ago #

    While there isn't any RFC spec that tells you how your url should be, www. never had any such use as to indicate the format or rendering of content. That is done by the http:// qualifier, which still doesn't indicate content but the protocol, i.e. instead of ftp:// or gopher://. The format of the content is and always has been indicated by the mime-type (not even the extension was ever used at the client, only, in old systems by the server to identify the mime type).

    It was always a technical matter. A domain, and sub-domains. Back in the old days, to technical people it was simply a grouping, such as .com and .org. In fact there is no technical reason why there shouldn't be a website at http://org/. The www is technically a standard sub-domain with NO special meaning. So it identifies a single machine in a particular domain. In the case of WPMU, the subdomain identifies a person's blog. The www is nothing but a social phenomena. It really serves no purpose at all, and especially when it comes to an environment like WMPU - which is based around subdomains - there is no need for the WWW and it only ads to the confusion.

    Also, the article that was referenced about yes on WWW is largely inaccurate and just bad info by whoever wrote it. http://digg.com/software/www_is_NOT_deprecated

  25. Anonymous
    Unregistered
    Posted 15 years ago #

    While there isn't any RFC spec that tells you how your url should be,

    And that is the only line that matters.

    If you really want to get into how jacked up DNS is then why don't we start by figuring out what genius set about so the TLD is the LAST thing in the series. I understand that "dot coms" is more poetic and a much better catch phrase than "com dots", but com.apple.www or org.wordpress.www is both more sequential and much easier to explain the logic of to a laymen than the mess we're stuck with.

    The original purpose of USING www's was to route traffic to web servers in days when it took dedicated boxes for each service. In todays world of monolithic servers we don't have that problem, but the general end-user neither knows nor cares. In my particular case http://www.x STILL refers to the web server among my servers, and in other cases it refers to the head of the web CLUSTER.

    Regardless of the argument, a project like MU *should not* be enforcing such a preference, especially not something that is as blatantly ridiculous as top vs bottom posting. It is up to the administrator of the blog how they want their site to be run, not up to the guys writing the open source framework. I could spend my morning hacking up MU to be the bullshit-free CMS i need it to be, or I can go install one of the 50 other CMS suites out there, or just simply roll my own since I have no real to require so much over head. Regardless, this project just went down a few notches in my book.

  26. cafespain
    Member
    Posted 15 years ago #

    "Regardless of the argument, a project like MU *should not* be enforcing such a preference"
    It's not, I can still access all of my main sites pages at http://www.mysite.com and mysite.com.
    My clients advertise their urls as http://www.theirsite.com and their visitors can get to the site with such. Those on sub-domains have even been known to advertise as http://www.sub.site.com and my DNS servers are setup to handle such a request.

    It "doesn't matter" that the url in the browser changes to the non www name. Once a person is on a site they use the navigation "on the site". How many people to do you know that look at the url once they have found the content they are after?

    In fact, out of habit now, I tend to type url.com into my browsers address bar when I know the domain I'm looking for, and it really annoys me when sites can't handle both www. and no-www. and I have to go back and type http://www.url.com in because I get a "site not found" error.

  27. MrBrian
    Member
    Posted 15 years ago #

    @peelman

    I don't know where you get the idea that MU is "enforcing" the preference that you exclude www. If you look at any other blogging network like blogger.com or blogspot.com, the www is not included as part of the subdomain URL. It's something completely unneeded in MU and this is how it works with open source - if you want something added to it, you code it and submit. Your opinion about WPMU is mislead - it's not even a CMS.

  28. andrea_r
    Moderator
    Posted 15 years ago #

    "In my particular case http://www.x STILL refers to the web server among my servers, and in other cases it refers to the head of the web CLUSTER."

    And that's because of how your web server was set up. take it up with your sys admin; it's not a WPMU issue.

    (and yes, you can force MU to use www)

  29. glenbot
    Member
    Posted 15 years ago #

    I decided to keep the WWW in the URL. Of course, as mentioned in many places this is a matter or preference. I wanted to keep it consistent with most if the web and not ever have a client wonder why the WWW was not in their URL. To accomplish this I just modified some lines of code in the wpmu-settings.php file to read:

    New Code:
    $dot_count = substr_count($domain,".");
    if ($dot_count == 1)
    $domain = 'www.'.$domain;

    Old Code:
    if( substr( $domain, 0, 4 ) == 'www.' )
    $domain = substr( $domain, 4 );

    Make sure that you edit the blog from the dashboard and add the WWW to the url.

    This will change -- http://yourdomain.com to http://www.yourdomain.com and you do not have to worry about losing both URLs or any sub-domains.

    Note: I am using MU 2.6.3

  30. sweetfunny
    Member
    Posted 15 years ago #

    Thanks Glenbot, was exactly what i was looking for but unfortunately in my case it done nothing.

    I want the main domain with www and sub-domains with http

    Currently my subs answer to http://www.sub.domain.com and redirect to just http://sub.domain.com which is exactly what i want but the primary domain does the same redirects from www to just http

    I will keep tinkering, i may have something funky going on in httpd.conf

About this Topic

  • Started 16 years ago by lucipublishing
  • Latest reply from andrea_r