Skip to content

Instantly share code, notes, and snippets.

@damncabbage
Last active October 8, 2018 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damncabbage/3a5db42a0218b396d2c654782e9a2607 to your computer and use it in GitHub Desktop.
Save damncabbage/3a5db42a0218b396d2c654782e9a2607 to your computer and use it in GitHub Desktop.
RewriteEngine on
# Manual rewrites; see ###s below.
RewriteRule questions/ questions.php [NC,L]
RewriteRule questions questions.php [NC,L]
RewriteRule episodes/ episodes.html [NC,L]
RewriteRule episodes episodes.html [NC,L]
RewriteRule links/ links.html [NC,L]
RewriteRule links links.html [NC,L]
# Add trailing slash to url
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
RewriteRule ^(.*)$ $1/ [R=301,L]
### Things that were tried locally on Apache 2.4 and yet
### don't work on Gandi for unknown reasons:
## Rewrite *.php to *
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME}.php –f
#RewriteRule ^(.*)$ $1.php [NC,L]
## Rewrite *.html to *
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME}.html –f
#RewriteRule ^(.*)$ $1.html [NC,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment