creat custom 503 error page

Discussion in 'Apache' started by abdo629, Jul 21, 2012.

  1. #1
    hi everyone

    i want to create a new 503 error page instead of the default one

    my Apache

    Apache/2.2.3 (CentOS)

    i am very beginner in Apache servers

    waiting your replay
     
    abdo629, Jul 21, 2012 IP
  2. Humza

    Humza Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It's very simple in Apache, if you're using a VirtualHost, within the wanted VirtualHost stanza paste the following:

    ErrorDocument 503 /path/to/my/503-file.php
    Code (markup):
    If you want the change globally across all sites, paste it in the httpd.conf anywhere, outside any stanza's. You can also paste it in a .htaccess file if you have them enabled. If I am wrong please, someone correct me, I haven't worked on Apache servers in a long time, my personal choice is nginx. ;)
     
    Humza, Jul 21, 2012 IP
  3. abdo629

    abdo629 Greenhorn

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    thanks for replay

    but in which file i should place this line
     
    abdo629, Jul 21, 2012 IP
  4. Humza

    Humza Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    In your httpd.conf, it's typically located at /etc/httpd/conf/httpd.conf, you can put it anywhere in the file, I'd put it at the bottom.
     
    Humza, Jul 21, 2012 IP
  5. abdo629

    abdo629 Greenhorn

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    thanks for replay

    but it did not work

    how can i enable .htaccess
     
    abdo629, Jul 21, 2012 IP
  6. Humza

    Humza Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Are you sure you changed /path/to/my/503-file.php to the path of your custom file? What is the path you used?

    Typically .htaccess is enabled by default, you just need to create a file called .htaccess in your sites directory, you would do it via SSH with something like this:

    cd /var/www/mysite_directory
    touch .htaccess
    echo "ErrorDocument 503 /error/myerrorpage/503.php" >> .htaccess
    Code (markup):
    Make sure to change the directories relative to your site.
     
    Humza, Jul 21, 2012 IP
  7. abdo629

    abdo629 Greenhorn

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #7
    this is the code i used
    ErrorDocument 503 /var/www/error/error503.html
     
    abdo629, Jul 21, 2012 IP