Browse Source

Support custom 404 pages in blog

Thomas Buck 5 years ago
parent
commit
efc165f792

+ 9
- 0
roles/blog/tasks/blog.yml View File

@@ -53,6 +53,15 @@
53 53
     force=no
54 54
   with_items: "{{ virtual_domains }}"
55 55
 
56
+- name: Create an example blog 404 error page
57
+  template:
58
+    src=var_www_blog_404.j2
59
+    dest={{ item.doc_root }}/404.html
60
+    owner=www-data
61
+    group=www-data
62
+    force=no
63
+  with_items: "{{ virtual_domains }}"
64
+
56 65
 - name: Create the Apache blog sites config files
57 66
   template:
58 67
     src=etc_apache2_sites-available_blog.j2

+ 1
- 0
roles/blog/templates/etc_apache2_sites-available_blog.j2 View File

@@ -20,4 +20,5 @@
20 20
     Options                 -Indexes
21 21
     HostnameLookups         Off
22 22
     php_admin_flag          engine On
23
+    ErrorDocument           404 /404.html
23 24
 </VirtualHost>

+ 9
- 0
roles/blog/templates/var_www_blog_404.j2 View File

@@ -0,0 +1,9 @@
1
+<html>
2
+	<head>
3
+		<title>404 - Page not found</title>
4
+	</head>
5
+	<body>
6
+		<h1>404 - {{ item.name }}</h1>
7
+		<p>Requested page could not be found!</p>
8
+	</body>
9
+</html>

Loading…
Cancel
Save