I can't seem to get a regexp I need to do in a RedirectMatch-statement to work.
Here's what I wanna do:
RedirectMatch Permanent ^/index.php?zone=12&action=do&id=5477$ /[zone-value]/[action-value]/[id-value]
So an URL of
http://www.mydomain.com/index.php?zone=B12&action=do&id=5477 redirects to
http://www.mycomain.com/B12/do/5477I tried this (and variants of it):
RedirectMatch Permanent ^/index.php?zone=(B12|A62|A50)&action=(.*)&id=([0-9]+)$ /$1/$2/$3
But it doesn't work.
The values for zone is alpha-numerical from a given set (B12|A62|A50), action is alpha-numerical and the value for id is just numerical.
I hope that made sense. Can somebody help me get this to work? Regular expressions really isn't my strongest skill I'm afraid.
----
"codito, ergo sum"
Comments
:
: Here's what I wanna do:
:
: RedirectMatch Permanent ^/index.php?zone=12&action=do&id=5477$ /[zone-value]/[action-value]/[id-value]
:
: So an URL of http://www.mydomain.com/index.php?zone=B12&action=do&id=5477 redirects to http://www.mycomain.com/B12/do/5477
:
: I tried this (and variants of it):
:
: RedirectMatch Permanent ^/index.php?zone=(B12|A62|A50)&action=(.*)&id=([0-9]+)$ /$1/$2/$3
:
: But it doesn't work.
:
: The values for zone is alpha-numerical from a given set (B12|A62|A50), action is alpha-numerical and the value for id is just numerical.
:
: I hope that made sense. Can somebody help me get this to work? Regular expressions really isn't my strongest skill I'm afraid.
:
: ----
: "codito, ergo sum"
:
I think that the problem is the (.*) expression. This will make &id= part of the action field. Thus
[code]
http://www.mydomain.com/index.php?zone=B12&action=do&id=5477
[/code]
actually redirects to
[code]
http://www.mycomain.com/B12/do&id=5477/
[/code]
I'm also not very good in regex or in the redirect rules of apache.
An alternative would be to let the index.php perform the redirect, since then you can use the URL query fields and concatenate them together to form a new url and get the results itself before forwarding them to the user. I'm not sure if php can perform this kind of redirecting.
Help = (Throwable.getStackTrace() == null || SourceCode == null) ? null : getHelp(e, SourceCode);
: :
: : Here's what I wanna do:
: :
: : RedirectMatch Permanent ^/index.php?zone=12&action=do&id=5477$ /[zone-value]/[action-value]/[id-value]
: :
: : So an URL of http://www.mydomain.com/index.php?zone=B12&action=do&id=5477 redirects to http://www.mycomain.com/B12/do/5477
: :
: : I tried this (and variants of it):
: :
: : RedirectMatch Permanent ^/index.php?zone=(B12|A62|A50)&action=(.*)&id=([0-9]+)$ /$1/$2/$3
: :
: : But it doesn't work.
: :
: : The values for zone is alpha-numerical from a given set (B12|A62|A50), action is alpha-numerical and the value for id is just numerical.
: :
: : I hope that made sense. Can somebody help me get this to work? Regular expressions really isn't my strongest skill I'm afraid.
: :
: : ----
: : "codito, ergo sum"
: :
: I think that the problem is the (.*) expression. This will make &id= part of the action field. Thus
: [code]
: http://www.mydomain.com/index.php?zone=B12&action=do&id=5477
: [/code]
: actually redirects to
: [code]
: http://www.mycomain.com/B12/do&id=5477/
: [/code]
: I'm also not very good in regex or in the redirect rules of apache.
: An alternative would be to let the index.php perform the redirect, since then you can use the URL query fields and concatenate them together to form a new url and get the results itself before forwarding them to the user. I'm not sure if php can perform this kind of redirecting.
:
:
:
: Help = (Throwable.getStackTrace() == null || SourceCode == null) ? null : getHelp(e, SourceCode);
:
:
Thanx for the suggestion but due to other technical details of the website I can't let index.php perform the redirect even though it would be fairly easy to do this with PHP.
----
"codito, ergo sum"
: : :
: : : Here's what I wanna do:
: : :
: : : RedirectMatch Permanent ^/index.php?zone=12&action=do&id=5477$ /[zone-value]/[action-value]/[id-value]
: : :
: : : So an URL of http://www.mydomain.com/index.php?zone=B12&action=do&id=5477 redirects to http://www.mycomain.com/B12/do/5477
: : :
: : : I tried this (and variants of it):
: : :
: : : RedirectMatch Permanent ^/index.php?zone=(B12|A62|A50)&action=(.*)&id=([0-9]+)$ /$1/$2/$3
: : :
: : : But it doesn't work.
: : :
: : : The values for zone is alpha-numerical from a given set (B12|A62|A50), action is alpha-numerical and the value for id is just numerical.
: : :
: : : I hope that made sense. Can somebody help me get this to work? Regular expressions really isn't my strongest skill I'm afraid.
: : :
: : : ----
: : : "codito, ergo sum"
: : :
: : I think that the problem is the (.*) expression. This will make &id= part of the action field. Thus
: : [code]
: : http://www.mydomain.com/index.php?zone=B12&action=do&id=5477
: : [/code]
: : actually redirects to
: : [code]
: : http://www.mycomain.com/B12/do&id=5477/
: : [/code]
: : I'm also not very good in regex or in the redirect rules of apache.
: : An alternative would be to let the index.php perform the redirect, since then you can use the URL query fields and concatenate them together to form a new url and get the results itself before forwarding them to the user. I'm not sure if php can perform this kind of redirecting.
: :
: :
: :
: : Help = (Throwable.getStackTrace() == null || SourceCode == null) ? null : getHelp(e, SourceCode);
: :
: :
:
: Thanx for the suggestion but due to other technical details of the website I can't let index.php perform the redirect even though it would be fairly easy to do this with PHP.
:
: ----
: "codito, ergo sum"
:
:
My current knowledge of regex is also very basic. My suggestion would be to change the (.*) into a (do|...|...) structure for the time being. You can always change it, if you found a better solution. Should I find a better solution, I'll give it to you.
Help = (Throwable.getStackTrace() == null || SourceCode == null) ? null : getHelp(e, SourceCode);