User Tools

Site Tools


custom_error_pages_for_your_site

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
custom_error_pages_for_your_site [2022/02/13 22:33] jquahcustom_error_pages_for_your_site [2022/12/05 06:29] (current) hc9
Line 1: Line 1:
 ====== Adding custom error pages to your SDF website ====== ====== Adding custom error pages to your SDF website ======
  
-The HTTP protocol, which is used to retrieve documents (usually web pages) from the internet for display in a web browser, provides a number of [[https://en.wikipedia.org/wiki/List_of_HTTP_status_codes| standard error codes]] to indicate conditions or status relative to the process. The most widely known of these is the notorious code 404 - "File not found." This error may occur for a number of reasons, but most commonly it indicates a broken link. Perhaps there is a typographical error in your html, or maybe the document was moved to a new location without the needed changes made to the referring link. What happens at this point is that the web browser asking for the missing document receives a special error message web page instead. This page is usually provided by the server, but may in some instances be generated by the browser. The error page may be rather generic, or it may be customized for the originating site.+The HTTP protocol, which is used to retrieve documents (usually web pages) from the internet for display in a web browser, provides a number of [[wp>List_of_HTTP_status_codes| standard error codes]] to indicate conditions or status relative to the process. The most widely known of these is the notorious code 404 - "File not found." This error may occur for a number of reasons, but most commonly it indicates a broken link. Perhaps there is a typographical error in your html, or maybe the document was moved to a new location without the needed changes made to the referring link. What happens at this point is that the web browser asking for the missing document receives a special error message web page instead. This page is usually provided by the server, but may in some instances be generated by the browser. The error page may be rather generic, or it may be customized for the originating site.
  
 ===== Why create a custom error page? ===== ===== Why create a custom error page? =====
Line 56: Line 56:
  
 Here are two possible ways to let your visitors use either style of URL, and still get your customized error page if they make a typo. They both involve duplication of the hosted content and (possibly manual) sync jobs. (To avoid these complications you might choose to: (a) disable the tilde-style URL --- ''mkhomepg -d'' will remove or insert your $LOGNAME in the ''UserDir enabled ...'' directive near the end of httpd.conf, (b) pare down the folder of the less-popular URL to a simple index.html that performs a redirect, or %%(c)%% try to hack together a workable combination of RewriteCond and RewriteRule directives that plays nicely with the UserDir settings in httpd.conf.) Here are two possible ways to let your visitors use either style of URL, and still get your customized error page if they make a typo. They both involve duplication of the hosted content and (possibly manual) sync jobs. (To avoid these complications you might choose to: (a) disable the tilde-style URL --- ''mkhomepg -d'' will remove or insert your $LOGNAME in the ''UserDir enabled ...'' directive near the end of httpd.conf, (b) pare down the folder of the less-popular URL to a simple index.html that performs a redirect, or %%(c)%% try to hack together a workable combination of RewriteCond and RewriteRule directives that plays nicely with the UserDir settings in httpd.conf.)
-  Delete the public_html symlink created by ''mkhomepg -d'', and make an actual folder of that name in your home directory. Give it and its parent directory loose enough permissions (go+rx should suffice) that the Apache "tilde user" can navigate to it. Periodically synchronize between public_html and html all content EXCEPT the .htaccess file, and make sure each folder's .htaccess gives the correct location relative to the DOCUMENT_ROOT (~/html/.htaccess contains ''ErrorDocument 404 /404.html'', while ~/public_html/.htaccess looks like ''ErrorDocument 404 /~altego/404.html''). +  * **Option 1:** Delete the public_html symlink created by ''mkhomepg -d'', and make an actual folder of that name in your home directory. Give it and its parent directory loose enough permissions (go+rx should suffice) that the Apache "tilde user" can navigate to it. Periodically synchronize between public_html and html all content EXCEPT the .htaccess file, and make sure each folder's .htaccess gives the correct location relative to the DOCUMENT_ROOT (~/html/.htaccess contains ''ErrorDocument 404 /404.html'', while ~/public_html/.htaccess looks like ''ErrorDocument 404 /~altego/404.html''). 
-  Upgrade your membership to MetaARPA and toggle vanity domain hosting to the MetaArray. The tilde-style URL will still resolve to the cluster, where ''ErrorDocument 404 /~altego/404.html'' will continue to work as before. The vanity domain will resolve to mab, where your content must be uploaded again into the appropriate directory, and the htaccess file modified to read ''ErrorDocument 404 /404.html''. With MetaARPA membership you can set up a cronjob to keep the contents of your two html directories (cluster and MetaArray) in sync.+  * **Option 2:** Upgrade your membership to MetaARPA and toggle vanity domain hosting to the MetaArray. The tilde-style URL will still resolve to the cluster, where ''ErrorDocument 404 /~altego/404.html'' will continue to work as before. The vanity domain will resolve to mab, where your content must be uploaded again into the appropriate directory, and the htaccess file modified to read ''ErrorDocument 404 /404.html''. With MetaARPA membership you can set up a cronjob to keep the contents of your two html directories (cluster and MetaArray) in sync.
  
 ===== Other changes you might need ===== ===== Other changes you might need =====
Line 72: Line 72:
  
 [[http://sdf.org/?tutorials/errorpage]] - traditional link (using [[wp>Revision_Control_System|RCS]]) [[http://sdf.org/?tutorials/errorpage]] - traditional link (using [[wp>Revision_Control_System|RCS]])
 +
custom_error_pages_for_your_site.1644791600.txt.gz · Last modified: 2022/02/13 22:33 by jquah