logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: multilanguage error document support
Author
justinacolmena



Joined: 03 Oct 2017
Posts: 6
Location: fairbanks, alaska, usa

PostPosted: Wed 04 Oct '17 18:28    Post subject: multilanguage error document support Reply with quote

Apache/2.4.27 (Fedora) OpenSSL/1.1.0f-fips PHP/7.1.9

my domain name is a spanish word, so accordingly i want the default language on my server to be spanish, and error messages to be served in spanish if that is acceptable to the browser.

then, for example, english pages, uploaded with a ".en" extension, will be served instead of spanish if they exist on the server and the browser accepts english and not spanish

the following configuration file is included on my server's apache distribution

Code:
/usr/share/doc/httpd/httpd-multilang-errordoc.conf


and the files below include the text of the error messages in all supported languages

Code:
[justina@colmena error]$ pwd
/usr/share/httpd/error
[justina@colmena error]$ ls
contact.html.var                     HTTP_METHOD_NOT_ALLOWED.html.var        HTTP_SERVICE_UNAVAILABLE.html.var
HTTP_BAD_GATEWAY.html.var            HTTP_NOT_FOUND.html.var                 HTTP_UNAUTHORIZED.html.var
HTTP_BAD_REQUEST.html.var            HTTP_NOT_IMPLEMENTED.html.var           HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
HTTP_FORBIDDEN.html.var              HTTP_PRECONDITION_FAILED.html.var       HTTP_VARIANT_ALSO_VARIES.html.var
HTTP_GONE.html.var                   HTTP_REQUEST_ENTITY_TOO_LARGE.html.var  include
HTTP_INTERNAL_SERVER_ERROR.html.var  HTTP_REQUEST_TIME_OUT.html.var          README
HTTP_LENGTH_REQUIRED.html.var        HTTP_REQUEST_URI_TOO_LARGE.html.var
[justina@colmena error]$


however i cannot get the multi-language error document support configured correctly ---

i'd like pointers to a little more documentation or tutorials on this particular feature
Back to top
justinacolmena



Joined: 03 Oct 2017
Posts: 6
Location: fairbanks, alaska, usa

PostPosted: Sat 07 Oct '17 3:27    Post subject: Reply with quote

more on this i was using google's seo tools -- yes i know they don't call it that (seo is a dirty word, but whatever, put yourself out there if you're going to have a web page) -- anyways google suggested something called "hreflang tags" -- a nice writeup on the whole concept https://moz.com/learn/seo/hreflang-tag

so i might have for example on one of my pages two alternate translations

Code:
<link rel="alternate" href="/las_abejas/" hreflang="es" />
<link rel="alternate" href="/the_bees/" hreflang="en" />


but i want to compare that to apache's native implementation if my server's default language were spanish, then ideally
Code:
/las_abejas/index.html

or even
Code:
/las_abejas/index.html.es

would be in spanish, and apache would either suggest in the http headers or simply serve at the requested url
Code:
/las_abejas/index.html.en

for english-speaking visitors (whose browsers are not configured to accept spanish)

so for best seo really it would be nice to have both methods of lanugage suggestion working correctly... any thoughts?
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3049
Location: Hilversum, NL, EU

PostPosted: Sat 07 Oct '17 13:34    Post subject: Reply with quote

Old, maybe useful info: https://httpd.apache.org/docs/2.0/misc/custom_errordocs.html


And Language directives at: https://httpd.apache.org/docs/trunk/mod/mod_negotiation.html
Back to top
justinacolmena



Joined: 03 Oct 2017
Posts: 6
Location: fairbanks, alaska, usa

PostPosted: Mon 09 Oct '17 5:35    Post subject: Reply with quote

Steffen wrote:
https://httpd.apache.org/docs/trunk/mod/mod_negotiation.html

wonderful. thank you. i think perhaps documentation lags behind development sometimes, but this second link you mentioned is up to date and covers the handling of the ".html.var" pages which were included as custom error docs in fedora's distribution of apache

i think my next tack is to get the mod_ language negotiation working for some of my normal pages, according to the official apache documentation, and when i become familiar with them, then i will tackle the custom error docs
Back to top


Reply to topic   Topic: multilanguage error document support View previous topic :: View next topic
Post new topic   Forum Index -> Apache