• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Website (subdomain?) Question"

Collapse

  • Platypus
    replied
    Originally posted by darrylmg View Post
    Have you tried putting and index.html page in the /subdomain/www directory?
    Just tried it. Nothing

    Leave a comment:


  • darrylmg
    replied
    Have you tried putting and index.html page in the /subdomain/www directory?

    Leave a comment:


  • Platypus
    replied
    Originally posted by darrylmg View Post
    This is what I think is happening.

    - you enter www.subdomaon.example.com in web browser.
    - web browser requests a dns lookup to get the ip address. This correctly returns the ip as you have said.
    - your web browser requests the default page at "/" which is the document root for the http address.
    - Apache is receiving your browser's request and accewsing the document root for www.subdomain.example.com, which is probably "/subdomain/www".
    - since there is no default page at that location (index.htm, index.html etc) the default hosting company page is kicking in.

    HTH
    Thanks. Good suggestion but it didn't work. I think you're on the right lines but the document that Apache is trying to access isn't at www.subdomain.example.com. This is the HTTP response I'm getting:

    Code:
    HTTP/1.1 404 Not Found 
    Date: Tue, 24 Jun 2014 08:29:03 GMT 
    Server: Apache/2.2.3 (CentOS) 
    Connection: close 
    Content-Type: text/html; charset=ISO-8859-1
    Without access to the error log file it's hard to guess what's happening!

    The directory structure I have is:

    /
    /cgi-bin
    /subdomain
    /www

    I have a deliberately broken .htaccess in all but cgi-bin and I'm not getting an error. I've also tried that in /subdomain/www/

    I've raised a ticket with easyspace

    Leave a comment:


  • Contreras
    replied
    Originally posted by Platypus View Post
    An update, hoping this might help you help me !

    I have a CNAME record which directs

    www. subdomain.example.com to subdomain.example.com

    I think it's working because if I ping subdomain.example.com and www. subdomain.example.com they both return the same IP address.

    But what I don't understand is what's happening when I visit the site. I deliberately broke the .htaccess file so that if I visit subdomain.example.com I get an error. But when I visit www. subdomain.example.com I don't get the error, I get redirected to the hoster's default "the domain name has been registered with us blah blah" page. So it's as if a visit to www. subdomain.example.com isn't "arriving" at the web server.

    Any ideas gratefully received. This must be SO common I'm amazed that Google hasn't found me a simple answer.

    Thanks!
    It sounds like you have the DNS side of it sorted.

    Can you get Apache error logs from the server?

    Apache needs to know about www. subdomain.example.com with a <VirtualHost> block as per your previous snippet. Is there already one of these for the plain www. example.com domain?

    When you visit www. example.com does it actually redirect to example.com (or vice versa), i.e. the URL in the browser bar consistently changes to one or the other? Or, is the same page available under those two separate addresses? This is the difference between using redirects and rewrites afaik, with redirects being the preferred mechanism.

    I would use wget (or similar) to query the url and trace what's happening from there.

    Leave a comment:


  • darrylmg
    replied
    This is what I think is happening.

    - you enter www.subdomaon.example.com in web browser.
    - web browser requests a dns lookup to get the ip address. This correctly returns the ip as you have said.
    - your web browser requests the default page at "/" which is the document root for the http address.
    - Apache is receiving your browser's request and accewsing the document root for www.subdomain.example.com, which is probably "/subdomain/www".
    - since there is no default page at that location (index.htm, index.html etc) the default hosting company page is kicking in.

    HTH

    Leave a comment:


  • darrylmg
    replied
    Also, the .htaccess you've created needs to go in the www folder, not the subdomain folder.
    Your Apache is probably setting up the document root for www to be the www directory.

    Edit: should be the www folder underneath "subdomain" folder.
    Last edited by darrylmg; 24 June 2014, 07:47.

    Leave a comment:


  • darrylmg
    replied
    Originally posted by Platypus View Post
    Humm I thought I had to do both.

    I tried creating a CNAME record like this:
    Code:
    www.subdomain.example.com subdomain.example.com
    I tried creating an A record like this:
    Code:
    www.example.com 99.99.99.99
    subdomain.example.com 99.99.99.99
    www.subdomain.example.com 99.99.99.99
    Then in .htaccess I have this
    Code:
    RewriteCond %{HTTP_HOST} ^www.subdomain.example.com
    RewriteRule ^(.*) http://subdomain.example.com [R=301,L]
    Ah but which .htaccess I hear you ask. On the web server when I FTP in, I see this structure:

    a file called .htaccess (this is the one where I have added the rewrite stuff)
    a folder called www
    a folder called subdomain
    a folder called cgi-bin

    In the subdomain folder there is a standard wordpress .htaccess file to whoch I have added so now it looks like this:

    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.subdomain.example.com
    RewriteRule ^(.*) http://subdomain.example.com [L]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    But without access to the Apache logs I can't get any insight as to how far it's getting before failing.

    EDIT: added code tags to stop forum software mangling my post
    Is there anyway that you can verify that mod_rewrite has been loaded into Apache?
    If your hosting provider have excluded it from the allowed modules, then it won't work.

    Leave a comment:


  • Platypus
    replied
    An update, hoping this might help you help me !

    I have a CNAME record which directs

    www. subdomain.example.com to subdomain.example.com

    I think it's working because if I ping subdomain.example.com and www. subdomain.example.com they both return the same IP address.

    But what I don't understand is what's happening when I visit the site. I deliberately broke the .htaccess file so that if I visit subdomain.example.com I get an error. But when I visit www. subdomain.example.com I don't get the error, I get redirected to the hoster's default "the domain name has been registered with us blah blah" page. So it's as if a visit to www. subdomain.example.com isn't "arriving" at the web server.

    Any ideas gratefully received. This must be SO common I'm amazed that Google hasn't found me a simple answer.

    Thanks!

    Leave a comment:


  • Platypus
    replied
    Originally posted by darrylmg View Post
    I would avoid using .htaccess files if I were you. Much safer to use CNAME records.
    Humm I thought I had to do both.

    I tried creating a CNAME record like this:
    Code:
    www.subdomain.example.com subdomain.example.com
    I tried creating an A record like this:
    Code:
    www.example.com 99.99.99.99
    subdomain.example.com 99.99.99.99
    www.subdomain.example.com 99.99.99.99
    Then in .htaccess I have this
    Code:
    RewriteCond %{HTTP_HOST} ^www.subdomain.example.com
    RewriteRule ^(.*) http://subdomain.example.com [R=301,L]
    Ah but which .htaccess I hear you ask. On the web server when I FTP in, I see this structure:

    a file called .htaccess (this is the one where I have added the rewrite stuff)
    a folder called www
    a folder called subdomain
    a folder called cgi-bin

    In the subdomain folder there is a standard wordpress .htaccess file to whoch I have added so now it looks like this:

    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.subdomain.example.com
    RewriteRule ^(.*) http://subdomain.example.com [L]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    But without access to the Apache logs I can't get any insight as to how far it's getting before failing.

    EDIT: added code tags to stop forum software mangling my post
    Last edited by Platypus; 23 June 2014, 14:30.

    Leave a comment:


  • darrylmg
    replied
    Also, see here for the syntax:

    http://www.inmotionhosting.com/suppo...-domain-to-new

    Leave a comment:


  • darrylmg
    replied
    Originally posted by Platypus View Post
    Ok I'm trying this in two stages.

    I've added the CNAME record and now when I go to www.thingy.mywebsite.com I'm redirected to some sort of holding page that says "this domain name has been registered with yoursupportservices.co.uk followed by some sponsored links.

    Does the extra CNAME record take some time to propogate, like DNS ?

    Next up, if I add this to .htaccess:

    Code:
    <VirtualHost *:80> 
        ServerName www.thingy.mywebsite.com 
        Redirect permanent / http://thingy.mywebsite.com/ 
    </VirtualHost>
    Then visiting thingy.mywebsite.com gives an "Internal Server Error" while www.thingy.mywebsite.com still gives the holding page

    i.e. I can no longer visit thingy.mywebsite.com, which of course used to work. If I revert the .htaccess, it works again.

    Where are you creating the .htaccess ?
    Have you added an additional document root in your HTTP server config?

    I would avoid using .htaccess files if I were you. Much safer to use CNAME records.

    Leave a comment:


  • NickFitz
    replied
    Originally posted by Platypus View Post
    Ok I'm trying this in two stages.

    I've added the CNAME record and now when I go to www.thingy.mywebsite.com I'm redirected to some sort of holding page that says "this domain name has been registered with yoursupportservices.co.uk followed by some sponsored links.

    Does the extra CNAME record take some time to propogate, like DNS ?

    Next up, if I add this to .htaccess:

    Code:
    <VirtualHost *:80> 
        ServerName www.thingy.mywebsite.com 
        Redirect permanent / http://thingy.mywebsite.com/ 
    </VirtualHost>
    Then visiting thingy.mywebsite.com gives an "Internal Server Error" while www.thingy.mywebsite.com still gives the holding page

    i.e. I can no longer visit thingy.mywebsite.com, which of course used to work. If I revert the .htaccess, it works again.

    The CNAME is a DNS record, but DNS propagates pretty quickly these days. It might be worth clearing the DNS cache on your local machine.

    With the .htaccess in place, do you see anything in the server error log? (I'm not sure if there should be anything or not, but that's usually my first port of call when trying to work out why none of this stuff works.)

    Leave a comment:


  • Platypus
    replied
    Ok I'm trying this in two stages.

    I've added the CNAME record and now when I go to www.thingy.mywebsite.com I'm redirected to some sort of holding page that says "this domain name has been registered with yoursupportservices.co.uk followed by some sponsored links.

    Does the extra CNAME record take some time to propogate, like DNS ?

    Next up, if I add this to .htaccess:

    Code:
    <VirtualHost *:80> 
        ServerName www.thingy.mywebsite.com 
        Redirect permanent / http://thingy.mywebsite.com/ 
    </VirtualHost>
    Then visiting thingy.mywebsite.com gives an "Internal Server Error" while www.thingy.mywebsite.com still gives the holding page

    i.e. I can no longer visit thingy.mywebsite.com, which of course used to work. If I revert the .htaccess, it works again.

    Leave a comment:


  • NickFitz
    replied
    Originally posted by Platypus View Post
    Ah! Thanks (that was quick).

    The solution suggests that this code goes in .htaccess

    Code:
    <VirtualHost *:80> 
        ServerName www.subdomain.example.com 
        Redirect permanent / http://subdomain.example.com/ 
    </VirtualHost>
    But the apache docs suggest that this goes into a config file. Do you happen to know which is correct?
    It should work in both, if the server is set up to use .htaccess files - they act as a mechanism for extending the main configuration file.

    Leave a comment:


  • Platypus
    replied
    Ah! Thanks (that was quick).

    The solution suggests that this code goes in .htaccess

    Code:
    <VirtualHost *:80> 
        ServerName www.subdomain.example.com 
        Redirect permanent / http://subdomain.example.com/ 
    </VirtualHost>
    But the apache docs suggest that this goes into a config file. Do you happen to know which is correct?

    Leave a comment:

Working...
X