KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm building a fairly large website and my .htaccess is starting to feel a bit bloated, is there a way of replacing my current system of - one rule for each of the possibile number of vars that could be passed, to one catch all expression that can account for varying numbers of inputs ? for example I currently have: RewriteRule ^([a-z]+)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)$ /index.php?mode=$1&id=$2&$3=$4&$5=$6 RewriteRule ^([a-z]+)/([^/]*)/([^/]*)/([^/]*)$ /index.php?mode=$1&id=$2&$3=$4 RewriteRule ^([a-z]+)/([^/]*)$ /index.php?mode=$1&id=$2 RewriteRule ^([a-z]+)$ /index.php?mode=$1 the first backreference is always the mode and (if any more exist) the second is always id , thereafter any further backreferences alternate between the name of the input and its value http://www.example.com/search http://www.example.com/search/3039/sort_by/name_asc/page/23 I would love to be able to have one expression to gracefully handle all the inputs.
Tags (comma-separated)
Save Edits
Cancel