Forum Moderators: phranque
RewriteRule ^downloads/c([^-]+)-(.*)/(.*)/(.*)/(.*)$ $3/$4/$5?%{QUERY_STRING} [L]
RewriteRule ^downloads/c([^-]+)-(.*)/(.*)/(.*)$ $3/$4?%{QUERY_STRING} [L]
RewriteRule ^downloads/c([^-]+)-(.*)/(.*)$ $3?%{QUERY_STRING} [L]
I wanted to just do (.*)$ but unfortunately it doesnt look like mod_rewrite will look past / when matching. I also tried using ((.*)¦/) but that wont work because both parethesis return results and I cant tell which $n is which.
[edited by: zRonin at 12:36 am (utc) on July 27, 2006]
I would suggest:
RewriteRule ^downloads/c[^\-]+-[^/]+/(.+)$ downloads/$1 [L]
This should handle any number of subdirectories in /downloads, removing the "/c<something>-<something>/ and retaining the rest; the query string should be passed through unchanged by default (you don't need to include it in the rule).
> I also tried using ((.*)¦/) but that wont work because both parethesis return results and I cant tell which $n is which.
That expression is ill-formed, but let's use ((ab)/cd) as a simple example. In order to resolve nested parentheses, count left parentheses; $1 would contain the whole matching string (ab/cd), while $2 would contain only the first part (ab).
If the above isn't what you need, please post an example with both an 'existing' and 'desired' complete local URL-path.
Jim