Solved

Pattern Matching %20 in url

Posted on 2014-01-31
5
680 Views
Last Modified: 2014-01-31
I have several urls that have %20''s in the actual url.  I want a regex that will point it to the correct page.  I can get it to work with the first 3 letters but don't know how to add in the %20.  I have tried \W and \s but to no avail.

If it is working correctly then a url with function.php shouldn't be matched.

This is an example url in question.
funct%20in%20/var/www/html/modules/cdseolinks/function.pa%20in%20/var/www/html/modules/cdseolinks/function.parse-url

Here is what I have.

RedirectMatch 301 ^/fun\s(.+?)$ /help.php

By the way, the ideal thing I know already but I don't have any support on that program to know how to fix the problem.  So that is why I am resorting to a pattern match.  Rather than getting the program to quit putting the erroneous characters into the urls when it is spidered.

Thanks,
0
Comment
Question by:sharingsunshine
  • 3
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
Angelp1ay earned 500 total points
ID: 39824603
I can't see how the help.php in your regex is related to your example URL.

Not really sure what you're asking for. I assumed you wanted things starting fun and ending with /help.php which might have the grouping %20 in them.

This should match %20 without matching %something_else...
fun((%20)|[\s\w\/\.\-])*\/help.php

Open in new window

0
 

Author Comment

by:sharingsunshine
ID: 39824782
that matches the %20 perfectly and /or a space.  So that is great.
0
 

Author Closing Comment

by:sharingsunshine
ID: 39824784
I appreciate your help.
0
 
LVL 11

Expert Comment

by:Angelp1ay
ID: 39824958
No problem :) Have a lovely weekend!
0
 

Author Comment

by:sharingsunshine
ID: 39824995
You too!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
number in printf 13 32
Activation for Microsoft Office for Mac 2016 3 68
Control iMac With MacBook Keyboard 5 51
How to change the nameserver on Ubuntu Server 6 50
The error "There was an error performing the update" occurred on a Mac OS X client workstation running  Symantec AntiVirus for Mac (http://www.symantec.com/business/products/purchasing.jsp?pcid=pcat_security&pvid=825_1) - the Enterprise product vers…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

828 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