Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts

    Problem with an added "www" ??

    Hi,

    Not sure if this is a PHP problem.

    I have set up a site which produces a webpage.

    eg villarentfethiye.simpg.net

    So an example page is:

    Villa Rental

    The page is converted to :

    http://simpg.net/info.php?a=villarentfethiye

    by the .htaccess file.

    This is the code:
    Code:
    RewriteCond %{HTTP_HOST} ^(.+).simpg.net [NC]
    RewriteCond %{HTTP_HOST} !=www.simpg.net [NC]
    RewriteRule ^.*$ http://simpg.net/info.php?a=%1 [NC,QSA,L]
    The problem is that some browsers apparently add a
    "www" to the front of the url automatically.

    So when they put "villarentfethiye.simpg.net" into the browser bar
    it tries to find "www.villarentfethiye.simpg.net"

    and then the system produces an error
    saying it can not find the page because it is tryying to
    locate: http://simpg.net/info.php?a=www.villarentfethiye
    which does not exist

    I am not sure of the best way to deal with this.

    Some thoughts ... ?

    Thanks.


    .
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Not a thing to do with PHP or your htaccess.
    If the browser is prepending www on front of a subdomain, than that is an issue with the user's browser. All you can do with it is remove the www from the provided input.
    If you are using subdomains though, you should actually set them up. Your control panel should have an option to do so. If they are not real subdomains, I can see that being a bit flaky. You'll need to modify the DNS records to use wildcarded domains as well if they are not yet set.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    Thanks for your reply.

    If they are not real subdomains, I can see that being a bit flaky.
    They are not real sub-domains because they are created when someone creates
    a new set of pages. So there could be thousands of them.

    I think that wordpress.com and blogger.com do the same thing and Google
    suggested that Hubpages.com do it that way as wel when they complained
    they had lost 50% of their traffic in the last update.

    Maybe the above three do actually create real subdomains on their servers, but I
    doubt it and I don't see the need when one line in the .htaccess file can deal with
    the situation and get the data from the database table.

    But do you think it could cause problems ?

    Also :
    You'll need to modify the DNS records to use wildcarded domains as well
    if they are not yet set.
    Do I need to do this even if I do not have REAL sub-domains ?

    I was thinking ...

    I guess I can check to see if there is a "www." at the beginning of the GET data
    and then strip it off before looking it up in the table ??

    Thanks for any thoughts.


    .
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    You would expect you need to set the wildcard domains. Otherwise, it will bind to site.com, and not to sub.site.com, so it won't actually route anywhere on the server. For these you'll need to contact someone proficient with DNS and webservers for the correct configurations.
    I didn't think that www. was valid prepended to a subdomain, but I could be wrong. Assuming that its not valid, than the browser is to blame, and not the configurations (unless it can somehow interpret it differently based on the httpd host).
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •