Solved

Pattern Matching Issue

Posted on 2014-01-31
6
190 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 37

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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
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…
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 …

770 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