Skip to content

Instantly share code, notes, and snippets.

@primitiveshaun
Last active March 14, 2021 13:28
Show Gist options
  • Save primitiveshaun/5c3eb6307f4b85901612eb2fb6c956ef to your computer and use it in GitHub Desktop.
Save primitiveshaun/5c3eb6307f4b85901612eb2fb6c956ef to your computer and use it in GitHub Desktop.
Apache - .htaccess Reference
# htaccess-rules.sh
# *** HOUSEKEEPING! Now that's how an Apache handles config... ***
# Master File: Maintained by Primitive Digital's Housekeeping Department
# https://primitivedigital.uk/housekeeping-department/
# STATUS ::: DRAFT: Requires Review
# N.B. You only need "RewriteEngine On" once in the .htaccess, before any RewriteCond and RewriteRule lines.
# N.B. If rules are duplicated the one that appears last has dominance.
# WordPress
# https://wordpress.org/support/article/htaccess/
# enable mod_rewrite
# https://httpd.apache.org/docs/current/mod/mod_rewrite.html
RewriteEngine On
# add a trailing slash to /wp-admin
# needs review
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
# .htaccess Fix for Infinite Loops
# needs review
RewriteBase /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment