Jump to content

[RegEx] Rewrite rule - How to?


gscrmn

Recommended Posts

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!!!!!

Link to comment
https://forums.phpfreaks.com/topic/264973-regex-rewrite-rule-how-to/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.