Skip to content

Instantly share code, notes, and snippets.

@andrii-marushchak
Created January 6, 2022 12:59
Show Gist options
  • Save andrii-marushchak/4c3d6c367f35d20f6d9a9350456d4156 to your computer and use it in GitHub Desktop.
Save andrii-marushchak/4c3d6c367f35d20f6d9a9350456d4156 to your computer and use it in GitHub Desktop.
# Custom 404 page
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ error.php [L]
# Force http to https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
# Remove .php from browser url
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment