Merge pull request #111 from silverstripe/dotcom-rewrites

Managed incoming silverstripe.com CNAMEs and redirect appropriately
This commit is contained in:
Christopher Pitt 2016-02-16 14:10:46 +13:00
commit f9b6b2be84
1 changed files with 5 additions and 2 deletions

View File

@ -29,10 +29,13 @@ ErrorDocument 500 /assets/error-500.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*).silverstripe.com$ [NC]
RewriteRule ^(.*)$ https://docs.silverstripe.org/$1 [L,R=301]
# Legacy rewrite from sapphire/ to framework/ namespace
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^framework/main\.php
RewriteRule ^sapphire/?(.*) http://doc.silverstripe.org/framework/$1 [R=301,L]
RewriteRule ^sapphire/?(.*) https://docs.silverstripe.org/framework/$1 [R=301,L]
# Rewrite framework to the new base url
RewriteCond %{REQUEST_URI} ^/?framework/en/
@ -41,7 +44,7 @@ ErrorDocument 500 /assets/error-500.html
# DokuWiki rewrite rules: Need to happen before other rules in order to redirect /doku.php?id=<pagename>
# to /pagename, which can then be matched by the legacy rewrite rules further down
RewriteCond %{QUERY_STRING} ^(\bid\b=([^&]*)&?(.*)?)
RewriteRule ^doku.php$ http://doc.silverstripe.org/%2?%3 [R=301,L]
RewriteRule ^doku.php$ https://docs.silverstripe.org/%2?%3 [R=301,L]
# Redirect legacy URLs (assumes we're not redirecting other assets, for performance reasons)
# Note: Just works on top-level domains, not if the webroot is in a subfolder