Forum Moderators: phranque
I'm trying to create a rewrite so any subfolders with go to index.php passing the folder names as variables behind the scenes. Something like this (but not as this isn't right)
RewriteRule http://example.com/([^/]+)/([^/]+)/([^/]+) http://example.com/index.php?s1=$1&s2=$2&s3=$3 [R]
Thanks
[edited by: jdMorgan at 12:51 pm (utc) on April 13, 2008]
[edit reason] example.com [/edit]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ /index.php?s1=$1&s2=$2&s3=$3 [L]
Note also that RewriteRule cannot "see" the query string or anything else, only the local URL-path. If you need to test or back-reference query strings or the domain name, then you must use a RewriteCond along with the appropriate variable to do so.
If you don't have any other working mod_rewrite [httpd.apache.org] rules, you'll need to set up and enable mod_rewrite using either both of the following directives, or only the second one, before you can use RewriteRules -- Only testing can tell you if the first line is needed (or allowed):
Options +FollowSymLinks
RewriteEngine on
[edited by: jdMorgan at 12:54 pm (utc) on April 13, 2008]