Forum Moderators: phranque
# Enable mod_rewrite, start rewrite engine
Options +FollowSymLinks
RewriteEngine on
#
# Internally rewrite search engine friendly static URL to dynamic filepath and query
RewriteRule ^([^/\\.]+)/([^/\\.]+)/([^/\\.]+)/([^/]+)/([^/\\.]+)/([^/]+)/([^/\\.]+)/([^/]+)/([^/\\.]+)/([^/]+)/?$ /index.php?controller=$1&controller_action=$2&$3=$4&$5=$6&$7=$8&$9=$10 [L]
RewriteRule ^([^/\\.]+)/([^/\\.]+)/([^/\\.]+)/([^/]+)/([^/\\.]+)/([^/]+)/([^/\\.]+)/([^/]+)/?$ /index.php?controller=$1&controller_action=$2&$3=$4&$5=$6&$7=$8 [L]
RewriteRule ^([^/\\.]+)/([^/\\.]+)/([^/\\.]+)/([^/]+)/([^/\\.]+)/([^/]+)/?$ /index.php?controller=$1&controller_action=$2&$3=$4&$5=$6 [L]
RewriteRule ^([^/\\.]+)/([^/\\.]+)/([^/\\.]+)/([^/]+)/?$ /index.php?controller=$1&controller_action=$2&$3=$4 [L]
RewriteRule ^([^/\\.]+)/([^/\\.]+)/?$ /index.php?controller=$1&controller_action=$2 [L]
RewriteRule ^([^/\\.]+)/?$ /index.php?controller=$1 [L]
Notice the pattern. Is it possible to do recursion in this file to handle this?
If you want to experiment with it, see the [N] and [E] flags -- [N] to restart, and [E] to set environment variables to 'pass yourself notes' about previous passes through the code.
The only thing I've found this method useful for in several years is that it's the only way to do mass character-replacement in an .htaccess context. In server config contexts, it's much easier to use RewriteMap to call a script.
Jim