Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Regular expression help needed

Posted on 2004-09-14
3
Medium Priority
?
243 Views
Last Modified: 2010-04-22
I need to construct a regex for Apache's RedirectMatch. I need the following:


RedirectMatch /somepath/to/some/directory/(.*)\.*rpm$ http://www.somedomain.com/$1/mydirectory/$2.rpm

Where the first * should redirect to a certain directory with the same name and the second * should be whole file:

Example:

~/directory/myfile.i386.rpm should go to http://myotherdomain/directory/i386/myfile.i386.rpm

or

~/directory/myfile.i686.rpm should go to http://myotherdomain/directory/i686/myfile.i686.rpm

What's the correct syntax?

0
Comment
Question by:nigg
[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
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 400 total points
ID: 12061057
I've not tried this on a web server, but it seems to me that you'd want to do:

RedirectMatch /path/to/directory/(.*)\.(.*)\.rpm http://www.domain.com/directory/$2/$1.$2.rpm
0
 
LVL 3

Author Comment

by:nigg
ID: 12061896
Know what? That's exactly what I did, however it did not work...I'll try it again...maybe I missed a dot somewhere...
0
 
LVL 3

Author Comment

by:nigg
ID: 12062057
Got it! Thanks to your input, I knew, where to look....and was sure now: I had in the URL a $ sign, which I had to escape...now it works! Thanks....
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

730 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