Solved

Pattern Matching Issue

Posted on 2014-01-31
6
205 Views
Last Modified: 2014-02-13
I have this url I need to regex to another link.  Here is the original link.

Tei%20Fu%20&%20Peppermint%20Oils%20w/%20Carrying%20Case_p_814.htm

Here is what I have tried
RedirectMatch 301 ^/Tei((%20)|[\s\w\/\.\-])Fu((%20)|[\s\w\/\.\-])&((%20)|[\s\w\/\.\-])Peppermint((%20)|[\s\w\/\.\-])Oils((%20)|[\s\w\/\.\-])w/((%20)|[\s\w\/\.\-])Carrying((%20)|[\s\w\/\.\-])Case_p_814\.htm$ /product.php?productid=56

In the browser it defaults to a discontinued page with this url
http://www.abc.com/tei-fu-peppermint-oils-w-carrying-case.html

Please tell me how to fix this?

Randal
0
Comment
Question by:sharingsunshine
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 39825508
%20 is a space, %2d is a hyphen, try substituting %20 with %2d in your pattern.
0
 

Author Comment

by:sharingsunshine
ID: 39825516
I changed the %20 to %2d but it didn't make any difference.  I think the problem may be with the w/ in the url. But I am not sure how to escape  it properly.  Between the word Oils and Carrying.
0
 
LVL 9

Expert Comment

by:Derek Jensen
ID: 39826599
A backslash:
w\/

And yeah, stick with the %20, as that's how .htaccess sees it. :-)
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

Author Comment

by:sharingsunshine
ID: 39827095
I stuck with the %20 and fixed the w\/ but it still won't match.  So can you see what the problem is?
0
 
LVL 9

Accepted Solution

by:
Derek Jensen earned 500 total points
ID: 39848797
Are you escaping all of your forward slashes?
0
 

Author Closing Comment

by:sharingsunshine
ID: 39857141
thanks, that did it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Article by: Justin
In light of the WannaCry ransomware attack that affected millions of Windows machines, you might wonder if your Mac needs protecting. Yes, it does and here is how to do it.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question