gscrmn Posted June 28, 2012 Share Posted June 28, 2012 Hello folks! This is my first post here and I need some help regarding RegEx. I need to make a Rewrite rule. Basically I have 3 situations: 1) www.mydomain.com 2) www.mydomain.com/?utm_source=source&utm_medium=banner&utm_campaign=blogs (Google URL Builder) 3) www.mydomain.com/blog or /chat, etc With situations 1 and 2 I need the rewrite rule to be active. But with situation 3, I don't want a redirect. So, I was wondering if this is correct: 1) ^ (http?://)?(www\.)?(mydomain\.com[/]?)$ 2) ^ (http?://)?(www\.)?(mydomain\.com[/]?)$([?]utm_source[=]) 3) Nothing Is that right? Is this secure? Okay? Or there is any other way to put just 1 single rule for all 3 situations? Oh... I almost forget! In situation 2, I need that the parameters (utm_source, etc) to go to the next page, so I can handle them So, I'm almost sure that I made it wrong, I miss something, right? Thanks a lot in advance!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/264973-regex-rewrite-rule-how-to/ Share on other sites More sharing options...
gscrmn Posted July 5, 2012 Author Share Posted July 5, 2012 Nobody? Quote Link to comment https://forums.phpfreaks.com/topic/264973-regex-rewrite-rule-how-to/#findComment-1359441 Share on other sites More sharing options...
NLT Posted July 6, 2012 Share Posted July 6, 2012 I am really confused on what you actually want to do.. Quote Link to comment https://forums.phpfreaks.com/topic/264973-regex-rewrite-rule-how-to/#findComment-1359725 Share on other sites More sharing options...
gscrmn Posted July 6, 2012 Author Share Posted July 6, 2012 It is pretty simple: RewriteRule ^/?$ /folder/file [L,R] Thanks Quote Link to comment https://forums.phpfreaks.com/topic/264973-regex-rewrite-rule-how-to/#findComment-1359767 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.