Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.