Forum Moderators: phranque
I am having problems using more than 8 variables and I see that apache can only handle 8 and it is possible to chain rewriterules together.
I read a post on this forum where this example was given
#rewriterule ^product([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-(.+)$ /script.php.$9?v1=$1&v2=$2&v3=$3&v4=$4&v5=$5&v6=$6&v7=$7&v8=$8 [C]
#rewriterule ^script\.php\.([^-]+)-([^-]+)-([^-]+)-([^-]+)no dash$ /script.php?v9=$1&v10=$2&v11=$3&v12=$4& [QSA,L]
I am trying to use the same logic with the beneath rule. (This rule would normally work, were it not for that pesky apache limitation!)
RewriteRule ^/?([-a-zA-Z0-9_\-]+)/([-a-zA-Z0-9_\-]+)/([a-zA-Z0-9]+)-([a-zA-Z0-9_\-]+)/([a-zA-Z0-9]+)-([a-zA-Z0-9_\-]+)/([a-zA-Z0-9]+)-([a-zA-Z0-9_\-]+)/([a-zA-Z0-9]+)-([a-zA-Z0-9_\-]+)/?$ index.php?sectionnameurl=$1&categorynameurl=$2&geta=$3&geturla=$4&getb=$5&geturlb=$6&getc=$7&geturlc=$8&getd=$9&geturld=$10 [NC]
Here is my attempt at converting the above rewriterule to the chained logic in the first example.
RewriteRule ^/?([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9]+)-([a-zA-Z0-9_\-]+)/([a-zA-Z0-9]+)-([a-zA-Z0-9_\-]+)/([a-zA-Z0-9]+)-([a-zA-Z0-9_\-]+)/$ index.php.$9?sec=$1&cat=$2&geta=$3&geturla=$4&getb=$5&geturlb=$6&getc=$7&geturlc=$8 [C]
RewriteRule ^([a-zA-Z0-9]+)-([a-zA-Z0-9_\-]+)$ /index.php?getd=$1&geturld=$2 [QSA,L]
I cant seem to get it to work no matter how hard i try :(
Any help is much appreciated
Cheers
Z
I get a 404 error no matter which combination I use.
Should I move this work out of htaccess and into my script?
The only problem with this is that I will still run out of variables at some point, because there are more (around 12 in total)
Really appreciate any advice as to how to tackle this.
Cheers
Z
Note that "script.php" need not be a real URL or a real file -- it is just used as a unique temporary name while we step through the chained rules.
Jim