Solved

Pattern Matching %20 in url

Posted on 2014-01-31
5
635 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
Comment Utility
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
Comment Utility
that matches the %20 perfectly and /or a space.  So that is great.
0
 

Author Closing Comment

by:sharingsunshine
Comment Utility
I appreciate your help.
0
 
LVL 11

Expert Comment

by:Angelp1ay
Comment Utility
No problem :) Have a lovely weekend!
0
 

Author Comment

by:sharingsunshine
Comment Utility
You too!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now