404 Page

Discussion in 'Programming' started by mouseclock, Aug 21, 2012.

  1. #1
    My website is build using HTML code and Cpanel. So how to set up a 404 page?

    I have already done mydomain.com/adasdasd ------ that redirects to my 404 page.

    But what about asdasdas.mydomain.com------- that does not redirect to my 404 page. How to fix that??????/
     
    mouseclock, Aug 21, 2012 IP
  2. Ray Baron

    Ray Baron Member

    Messages:
    148
    Likes Received:
    10
    Best Answers:
    3
    Trophy Points:
    43
    #2
    asdasdas.mydomain.com is a subdomain of mydomain.com and, technically, a completely different domain than mydomain.com. If you want subdomain.mydomain.com to direct to a 404 page (or anywhere else) you will have to do that with mod_rewrite.

    This is fairly simple if you only have one subdomain. But if you have a wildcard A record in your zone file, it becomes a bit more complicated. Here is how you fix the problem as described:

    In the root web space for asdasdas.mydomain.com put this in an .htaccess file:

    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^asdasdas\.mydomain\.com$
    RewriteRule ^/(.*) http://mydomain.com/$1 [NC,R]
    
    Code (markup):
     
    Ray Baron, Aug 21, 2012 IP
  3. techlead

    techlead Active Member

    Messages:
    213
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    You need to place 404 SHTML pages in your subdomain
     
    techlead, Aug 25, 2012 IP
  4. Ray Baron

    Ray Baron Member

    Messages:
    148
    Likes Received:
    10
    Best Answers:
    3
    Trophy Points:
    43
    #4
    Why? And how does that relate to the question the original poster asked?
     
    Ray Baron, Aug 25, 2012 IP
  5. techlead

    techlead Active Member

    Messages:
    213
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #5

    Because the same problem happened to me. I simply placed two shtml files in my sub domain redirecting to 404 error pages successfully
     
    techlead, Aug 25, 2012 IP
  6. Ray Baron

    Ray Baron Member

    Messages:
    148
    Likes Received:
    10
    Best Answers:
    3
    Trophy Points:
    43
    #6
    The OP already has a 404 on his primary domain and he wants to redirect his subdomains to that 404 page.

    shtml is used to tell the server the page uses SSI (server side includes). (http://en.wikipedia.org/wiki/Server_Side_Includes)

    shtml has nothing to do with 404 pages or with redirecting pages.
     
    Ray Baron, Aug 25, 2012 IP
  7. elitestar47

    elitestar47 Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I can get that fixed for you for free. PM me and I will do that instantly.

    Thanks,
    Best Regards,
    Team - Elite.
     
    elitestar47, Aug 26, 2012 IP