Forum Moderators: phranque
More resources are available in our Forum Charter and in the Apache section of the WebmasterWorld Library (see links at the top of this page).
While designing your solution, be aware of two things:
First, you may not use "blank" path-parts in the URL. Apache will treat a request for
localhost/47876/4876//4246/345436/345876#modelviewer:11+1
as if it were a request for
localhost/47876/4876/4246/345436/345876#modelviewer:11+1
You will need to put *something* into that blank field, such as a hyphen, underscore, or tilde (~).
Second, you may not use a "#" character in a URL. While it is acceptable to use it in a query string attached to a URL -- as in the query string of your dynamic URL, browsers will not send a "#" as part of the URL itself. The "#" is reserved for use as a "named anchor," used for navigation *within* a page already loaded by the browser.
I suggest you use a different character in the URL, and use mod_rewrite translate it back to a "#" in the query string. For more details, see the HTTP URL specification, RFC2396: RFC2396 - Uniform Resource Identifiers (URI): Generic Syntax [faqs.org].
Jim
BUT the same with 30 vars dont work:
RewriteRule (.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/$ /?e1=$1&e2=$2&e3=$3&e4=$4&e5=$5&e6=$6&e7=$7&e8=$8&9=$9&e10=$10&e11=$11&e12=$12&e13=$13&e14=$14&e15=$15&e16=$16&e17=$17&e18=$18&e19=$19&e20=$20&e21=$21&e22=$22&e23=$23&e24=$24&e25=$25&e26=$26&e27=$27&e28=$28&e29=$29&e30=$30
I know that it is a little longer, but i need this variables
Two comments: Your URLs are far too long, and little advantage will be gained from changing them to static form.
Also, the use of multiple ".*" subpatterns --especially as many as you've got-- is extremely slow and inefficient, because ".*" matches *anything and everything*. Therefore, on the intial pass, mod_rewrite will match the entire URL-path into the first ".*" pattern that it finds. It will then fail upon encountering the first "/" in your pattern, because the first ".*" will have "consumed" the entire URL-path.
So, mod_rewrite will "back off" one character from the end and try again. It may have to retry tens of thousands of times, for each possible "division" of the URL-path into your pattern. I would guess that your server would be crippled by such a rule if you ever get more than ten requests per second. And that assumes that you have a modern and dedicated --not shared-- server.
Use of a pattern such as ^([^/]+)/([^/]+)$ is *far* more efficient, because it tells mod_rewrite exactly when to stop matching on the first sub-pattern -- as soon as it finds a slash.
A way forward on the 9-back-reference limit is to use multiple chained rules, for example:
RewriteRule ^([^/]+)/([^/]+)/(.+)$ /$3?e1=$1&e2=$2 [C]
RewriteRule ^([^/]+)/([^/]+)/(.+)$ /$3?e3=$1&e4=$2 [QSA,C]
RewriteRule ^([^/]+)/([^/]+)/(.+)$ /$3?e5=$1&e6=$2 [QSA,C]
...
# last chained rule
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ /?e7=$1&e8=$2&e9=$3 [QSA,L]
It is possible that you may encounter a documented mod_rewrite bug in Apache [archive.apache.org]. If the results of the above approach are incorrect, then there are several work-around methods which we can discuss.
Jim