rewriterule with multiple optional arguments
3 posts
• Page 1 of 1
rewriterule with multiple optional arguments
hello all,
I have to rewrite multiple variables separated by / to the same but separated by &, the problem is that the number of variables is not always the same, it is optional.
It can go from 3 variables to 12, now I have 9 rewrite rules, starting by 12 variables and finishing with 3 but looks like this number keeps changing.
These are some lines of what I have now:
RewriteRule ^ABC/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)(.*) /Site.aspx?&$1&$2&$3&$4&$5&$6&$7 [NC,I]
RewriteRule ^ABC/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)(.*) /Site.aspx?&$1&$2&$3&$4&$5&$6 [NC,I]
RewriteRule ^ABC/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)(.*) /Site.aspx?&$1&$2&$3&$4&$5 [NC,I]
RewriteRule ^ABC/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)(.*) /Site.aspx?&$1&$2&$3&$4 [NC,I]
RewriteRule ^ABC/([^/]*)/([^/]*)/([^/]*)/([^/]*)(.*) /Site.aspx?&$1&$2&$3 [NC,I]
Is it possible to have all this in only one line and not depending anymore on the number of parameters?
Thank you,
Charly
I have to rewrite multiple variables separated by / to the same but separated by &, the problem is that the number of variables is not always the same, it is optional.
It can go from 3 variables to 12, now I have 9 rewrite rules, starting by 12 variables and finishing with 3 but looks like this number keeps changing.
These are some lines of what I have now:
RewriteRule ^ABC/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)(.*) /Site.aspx?&$1&$2&$3&$4&$5&$6&$7 [NC,I]
RewriteRule ^ABC/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)(.*) /Site.aspx?&$1&$2&$3&$4&$5&$6 [NC,I]
RewriteRule ^ABC/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)(.*) /Site.aspx?&$1&$2&$3&$4&$5 [NC,I]
RewriteRule ^ABC/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)(.*) /Site.aspx?&$1&$2&$3&$4 [NC,I]
RewriteRule ^ABC/([^/]*)/([^/]*)/([^/]*)/([^/]*)(.*) /Site.aspx?&$1&$2&$3 [NC,I]
Is it possible to have all this in only one line and not depending anymore on the number of parameters?
Thank you,
Charly
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: rewriterule with multiple optional arguments
Hello,
I can tell from the experience, that having from 3 to 12 simple rules is better and more reliable than 1 complicated. There's no magic fixes, and if there's it's will not ensure flawless performance.
My suggestion would be to leave those rules as is, since they are doing the job.
Regards
Andrew
I can tell from the experience, that having from 3 to 12 simple rules is better and more reliable than 1 complicated. There's no magic fixes, and if there's it's will not ensure flawless performance.
My suggestion would be to leave those rules as is, since they are doing the job.
Regards
Andrew
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: rewriterule with multiple optional arguments
You won't win performance by reducing the number of lines in this case.
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 14 guests