Forum Moderators: phranque
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.website.com/test/$1/ [L,R=301]
DirectoryIndex index.php
RewriteEngine On
#
# Redirect requests for index.php URLs to URL for folder, ending in slash.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^test/(([^/]+/)*)index\.php$ http://www.example.com/test/$1 [R=301,L]
#
# Redirect requests for .php URLs to matching extensionless URL without slash.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*[^/.]+\.php\ HTTP/
RewriteRule ^test/(([^/]+/)*[^/.]+)\.php$ http://www.example.com/test/$1 [R=301,L]
#
# Rewrite extensionless URL requests to internally find the respective .php file.
RewriteRule ^test/(([^/]+/)*[^/.]+)$ /$1.php [L] www.example.com/test/folder/index/ as being valid URLs on your site. The canonical URL should be www.example.com/test/folder/.