?
Solved

Pattern Matching Issue

Posted on 2014-01-31
6
Medium Priority
?
217 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
  • 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

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

We could spend the next millennium discussing the differences of the Mac and Windows platforms. The next century will continue to have fanatics on both side of the equation and neither side will win the war. However, that’s not why we are here. W…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

850 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