diff options
-rw-r--r-- | apache2/conf-available/local-html5-www-add.conf | 47 | ||||
-rw-r--r-- | apache2/conf-available/local-html5-www-strip.conf | 47 | ||||
-rw-r--r-- | apache2/conf-available/local-html5.conf | 41 |
3 files changed, 95 insertions, 40 deletions
diff --git a/apache2/conf-available/local-html5-www-add.conf b/apache2/conf-available/local-html5-www-add.conf new file mode 100644 index 0000000..c7a9fb8 --- /dev/null +++ b/apache2/conf-available/local-html5-www-add.conf @@ -0,0 +1,47 @@ +# Apache Server Configs v2.14.0 | MIT License +# https://github.com/h5bp/server-configs-apache + +# ---------------------------------------------------------------------- +# | Suppressing / Forcing the `www.` at the beginning of URLs | +# ---------------------------------------------------------------------- + +# The same content should never be available under two different +# URLs, especially not with and without `www.` at the beginning. +# This can cause SEO problems (duplicate content), and therefore, +# you should choose one of the alternatives and redirect the other +# one. +# +# By default `Option 1` (no `www.`) is activated. +# http://no-www.org/faq.php?q=class_b +# +# If you would prefer to use `Option 2`, just comment out all the +# lines from `Option 1` and uncomment the ones from `Option 2`. +# +# (!) NEVER USE BOTH RULES AT THE SAME TIME! + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Option 1: rewrite www.example.com → example.com + +#<IfModule mod_rewrite.c> +# RewriteEngine On +# RewriteCond %{HTTPS} !=on +# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] +# RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L] +#</IfModule> + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Option 2: rewrite example.com → www.example.com +# +# Be aware that the following might not be a good idea if you use "real" +# subdomains for certain parts of your website. + +<IfModule mod_rewrite.c> + RewriteEngine On + RewriteCond %{HTTPS} !=on + RewriteCond %{HTTP_HOST} !^www\. [NC] + RewriteCond %{SERVER_ADDR} !=127.0.0.1 + RewriteCond %{SERVER_ADDR} !=::1 + RewriteRule ^ %{ENV:PROTO}://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] +</IfModule> diff --git a/apache2/conf-available/local-html5-www-strip.conf b/apache2/conf-available/local-html5-www-strip.conf new file mode 100644 index 0000000..dd79991 --- /dev/null +++ b/apache2/conf-available/local-html5-www-strip.conf @@ -0,0 +1,47 @@ +# Apache Server Configs v2.14.0 | MIT License +# https://github.com/h5bp/server-configs-apache + +# ---------------------------------------------------------------------- +# | Suppressing / Forcing the `www.` at the beginning of URLs | +# ---------------------------------------------------------------------- + +# The same content should never be available under two different +# URLs, especially not with and without `www.` at the beginning. +# This can cause SEO problems (duplicate content), and therefore, +# you should choose one of the alternatives and redirect the other +# one. +# +# By default `Option 1` (no `www.`) is activated. +# http://no-www.org/faq.php?q=class_b +# +# If you would prefer to use `Option 2`, just comment out all the +# lines from `Option 1` and uncomment the ones from `Option 2`. +# +# (!) NEVER USE BOTH RULES AT THE SAME TIME! + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Option 1: rewrite www.example.com → example.com + +<IfModule mod_rewrite.c> + RewriteEngine On + RewriteCond %{HTTPS} !=on + RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] + RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L] +</IfModule> + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Option 2: rewrite example.com → www.example.com +# +# Be aware that the following might not be a good idea if you use "real" +# subdomains for certain parts of your website. + +# <IfModule mod_rewrite.c> +# RewriteEngine On +# RewriteCond %{HTTPS} !=on +# RewriteCond %{HTTP_HOST} !^www\. [NC] +# RewriteCond %{SERVER_ADDR} !=127.0.0.1 +# RewriteCond %{SERVER_ADDR} !=::1 +# RewriteRule ^ %{ENV:PROTO}://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] +# </IfModule> diff --git a/apache2/conf-available/local-html5.conf b/apache2/conf-available/local-html5.conf index cc490bf..aedc96a 100644 --- a/apache2/conf-available/local-html5.conf +++ b/apache2/conf-available/local-html5.conf @@ -359,46 +359,7 @@ AddDefaultCharset utf-8 # | Suppressing / Forcing the `www.` at the beginning of URLs | # ---------------------------------------------------------------------- -# The same content should never be available under two different -# URLs, especially not with and without `www.` at the beginning. -# This can cause SEO problems (duplicate content), and therefore, -# you should choose one of the alternatives and redirect the other -# one. -# -# By default `Option 1` (no `www.`) is activated. -# http://no-www.org/faq.php?q=class_b -# -# If you would prefer to use `Option 2`, just comment out all the -# lines from `Option 1` and uncomment the ones from `Option 2`. -# -# (!) NEVER USE BOTH RULES AT THE SAME TIME! - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Option 1: rewrite www.example.com → example.com - -<IfModule mod_rewrite.c> - RewriteEngine On - RewriteCond %{HTTPS} !=on - RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] - RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L] -</IfModule> - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Option 2: rewrite example.com → www.example.com -# -# Be aware that the following might not be a good idea if you use "real" -# subdomains for certain parts of your website. - -# <IfModule mod_rewrite.c> -# RewriteEngine On -# RewriteCond %{HTTPS} !=on -# RewriteCond %{HTTP_HOST} !^www\. [NC] -# RewriteCond %{SERVER_ADDR} !=127.0.0.1 -# RewriteCond %{SERVER_ADDR} !=::1 -# RewriteRule ^ %{ENV:PROTO}://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] -# </IfModule> +# (moved to separate snippets) # ###################################################################### |