Created
January 26, 2015 19:06
-
-
Save AD7six/b2a513b8fae3e04e7220 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@h5bp:~# cat /etc/apache2/sites-enabled/000-default.conf | |
<VirtualHost *:80> | |
ServerName www.example.com | |
ServerAlias *.example.* | |
DocumentRoot /var/www/html5-boilerplate/fixtures/ | |
ErrorLog ${APACHE_LOG_DIR}/example-error.log | |
CustomLog ${APACHE_LOG_DIR}/example-access.log combined | |
RewriteEngine on | |
LogLevel alert rewrite:trace8 | |
# Redirect no-www requests to www.example.com | |
RewriteCond %{HTTP_HOST} ^example | |
RewriteRule ^ http://www.example.com%{REQUEST_URI} [R=301,L] | |
# Redirect requests on the wrong tld to .com | |
RewriteCond %{HTTP_HOST} ^(www|webtest)\.example\.(?!com) | |
RewriteRule ^ http://%1.example.com%{REQUEST_URI} [L,R=301] | |
</VirtualHost> | |
root@h5bp:~# curl -I -H "Host: example.com" http://localhost | |
HTTP/1.1 301 Moved Permanently | |
Date: Mon, 26 Jan 2015 19:05:22 GMT | |
Server: Apache/2.4.10 (Debian) OpenSSL/1.0.1e | |
Location: http://www.example.com/ | |
Content-Type: text/html; charset=iso-8859-1 | |
root@h5bp:~# curl -I -H "Host: example.net" http://localhost | |
HTTP/1.1 301 Moved Permanently | |
Date: Mon, 26 Jan 2015 19:05:26 GMT | |
Server: Apache/2.4.10 (Debian) OpenSSL/1.0.1e | |
Location: http://www.example.com/ | |
Content-Type: text/html; charset=iso-8859-1 | |
root@h5bp:~# curl -I -H "Host: example.co.uk" http://localhost | |
HTTP/1.1 301 Moved Permanently | |
Date: Mon, 26 Jan 2015 19:05:32 GMT | |
Server: Apache/2.4.10 (Debian) OpenSSL/1.0.1e | |
Location: http://www.example.com/ | |
Content-Type: text/html; charset=iso-8859-1 | |
root@h5bp:~# curl -I -H "Host: www.example.com" http://localhost | |
HTTP/1.1 200 OK | |
Date: Mon, 26 Jan 2015 19:05:43 GMT | |
Server: Apache/2.4.10 (Debian) OpenSSL/1.0.1e | |
Last-Modified: Sat, 10 Jan 2015 09:56:09 GMT | |
ETag: "83-50c4948518040" | |
Accept-Ranges: bytes | |
Content-Length: 131 | |
Vary: Accept-Encoding | |
Content-Type: text/html | |
root@h5bp:~# curl -I -H "Host: www.example.co.uk" http://localhost | |
HTTP/1.1 301 Moved Permanently | |
Date: Mon, 26 Jan 2015 19:05:47 GMT | |
Server: Apache/2.4.10 (Debian) OpenSSL/1.0.1e | |
Location: http://www.example.com/ | |
Content-Type: text/html; charset=iso-8859-1 | |
root@h5bp:~# curl -I -H "Host: webtest.example.com" http://localhost | |
HTTP/1.1 200 OK | |
Date: Mon, 26 Jan 2015 19:05:58 GMT | |
Server: Apache/2.4.10 (Debian) OpenSSL/1.0.1e | |
Last-Modified: Sat, 10 Jan 2015 09:56:09 GMT | |
ETag: "83-50c4948518040" | |
Accept-Ranges: bytes | |
Content-Length: 131 | |
Vary: Accept-Encoding | |
Content-Type: text/html | |
root@h5bp:~# curl -I -H "Host: webtest.example.co.uk" http://localhost | |
HTTP/1.1 301 Moved Permanently | |
Date: Mon, 26 Jan 2015 19:06:03 GMT | |
Server: Apache/2.4.10 (Debian) OpenSSL/1.0.1e | |
Location: http://webtest.example.com/ | |
Content-Type: text/html; charset=iso-8859-1 | |
root@h5bp:~# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment