Skip to content

Commit

Permalink
Homepage: Added an error page for invalid web addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 19, 2017
1 parent 603a133 commit 570cf78
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
28 changes: 25 additions & 3 deletions web2/.htaccess
@@ -1,31 +1,53 @@
AddType application/octet-stream .pk3 .zip
AddType application/x-gzip .gz .txt.gz

Header set Access-Control-Allow-Origin "http://dengine.net"
ErrorDocument 404 index.php

ErrorDocument 404 /not-found.html

RewriteEngine on
RewriteBase /

# Redirect www subdomain.
RewriteCond %{HTTP_HOST} www\.dengine\.net [NC]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ http://dengine.net/$1 [R=301,QSA,L]

RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^builds$ http://api.dengine.net/1/builds [R=301,L]

RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^build([0-9]+)/?$ http://api.dengine.net/1/builds?number=$1&format=html [R=301,L]

RewriteCond %{REQUEST_URI} support
RewriteCond %{REQUEST_URI} ^support
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ talk/categories/technical-support [R=301,L]

RewriteCond %{REQUEST_URI} forums.*
RewriteCond %{REQUEST_URI} ^forums.*
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^forums(.*)$ talk$1 [R=301,QSA,L]

RewriteCond %{REQUEST_URI} ^blog.*
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^blog(.*)$ http://blog.dengine.net/$1 [R=301,QSA,L]

# Remove trailing slash.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.*)/$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)/$ $1 [R=301,L]

# Append .php extension.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*) $1.php [L,QSA]
24 changes: 24 additions & 0 deletions web2/not-found.html
@@ -0,0 +1,24 @@
<html>
<head>
<title>dengine.net | Not Found</title>
<link href='https://dengine.net/theme/stylesheets/site.css' rel='stylesheet' type='text/css'>
<style type="text/css">
body { text-align: center; }
a { color: white; }
#error-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translate(-50%,-50%);
}
</style>
</head>
<body>
<div id="error-content">
<h1>Not Found</h1>
<p>The requested page does not exist on <a href="http://dengine.net">dengine.net</a>. Please check the address.</p>
</div>
</body>
</html>

0 comments on commit 570cf78

Please sign in to comment.