Skip to content

Instantly share code, notes, and snippets.

@nstone101
Created November 12, 2020 07:42
Show Gist options
  • Save nstone101/85c205406649b67b650b608518b5f11c to your computer and use it in GitHub Desktop.
Save nstone101/85c205406649b67b650b608518b5f11c to your computer and use it in GitHub Desktop.
## remove domain extension remove .html remove .php remove last extension .htaccess file
## Redirects example.com/cool-page.html to example.com/cool-page
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteCond %{REQUEST_URI} ^(.+)\.html$
RewriteRule (.*)\.html$ /$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment