1RewriteEngine On
2RewriteCond %{REQUEST_FILENAME} !-f
3RewriteRule ^([^\.]+)$ $1.php [NC,L]
4
1RewriteEngine On
2RewriteCond %{REQUEST_FILENAME} !-f
3RewriteRule ^([^/]+)/$ $1.php
4RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
5RewriteCond %{REQUEST_FILENAME} !-f
6RewriteCond %{REQUEST_FILENAME} !-d
7RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
8RewriteRule (.*)$ /$1/ [R=301,L]
9
10#This works with xxx/index.php too (visiting mysite.com/xxx/)
1# Apache Rewrite Rules
2 <IfModule mod_rewrite.c>
3 Options +FollowSymLinks
4 RewriteEngine On
5 RewriteBase /
6
7# Add trailing slash to url
8 RewriteCond %{REQUEST_FILENAME} !-f
9 RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
10 RewriteRule ^(.*)$ $1/ [R=301,L]
11
12# Remove .php-extension from url
13 RewriteCond %{REQUEST_FILENAME} !-d
14 RewriteCond %{REQUEST_FILENAME}\.php -f
15 RewriteRule ^([^\.]+)/$ $1.php
16
17# End of Apache Rewrite Rules
18 </IfModule>
19