Skip to content

Instantly share code, notes, and snippets.

@jonathanablanida
Created October 28, 2015 18:57
Show Gist options
  • Save jonathanablanida/6247118b5b969df16a42 to your computer and use it in GitHub Desktop.
Save jonathanablanida/6247118b5b969df16a42 to your computer and use it in GitHub Desktop.
#Jae Redirect
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
# This will redirect you from http://www.example.com/username.php to http://www.example.com/username externally
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]
# This will redirect you from http://www.example.com/username to http://www.example.com/username internally
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment