You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before internet.nl is testing both without and with www, some practical knowledge may help.
For advanced conditional logic, Apache 2.4 introduced Apache Expression Language (mod_expr).
The first URL via HTTPS can be refreshed, as security headers strictly require, with a conditional redirect.
Redirect in .htaccess if www:
<If "%{HTTP_HOST} =~ /^www.example.com$/">
# Redirect 302 / https://example.com/
Redirect in .htaccess if no www:
<If "! (%{HTTP_HOST} =~ /^www.example.com$/)">
Redirect 302 / https://www.example.com/
</If
My suggestion is to document a conditional redirect in .htaccess in a suitable place.
This issue has been edited for these notes:
The escaped dot for Apache configuration is not visible in HTML, therefore also a screenshot;
The Redirect directive may not work within . Maybe use RedirectMatch or Rewrite some way;
An example for Nginx would complete.
The text was updated successfully, but these errors were encountered:
Probably the toolbox-wiki is the best location for configuration samples.
However domain canonicalization issues are not in scope of Internet.nl, in the sense that these - to my knowledge - are not listed in a 'comply or explain', NCSC guideline or other Best Current Practices.
baknu
transferred this issue from internetstandards/Internet.nl
Feb 14, 2025
Before internet.nl is testing both without and with www, some practical knowledge may help.
For advanced conditional logic, Apache 2.4 introduced Apache Expression Language (mod_expr).
The first URL via HTTPS can be refreshed, as security headers strictly require, with a conditional redirect.
Redirect in .htaccess if www:
<If "%{HTTP_HOST} =~ /^www.example.com$/">
# Redirect 302 / https://example.com/
Redirect in .htaccess if no www:
<If "! (%{HTTP_HOST} =~ /^www.example.com$/)">
Redirect 302 / https://www.example.com/
</If
My suggestion is to document a conditional redirect in .htaccess in a suitable place.
This issue has been edited for these notes:
The text was updated successfully, but these errors were encountered: