Solved

Regular expression help needed

Posted on 2004-09-14
3
236 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
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 100 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

19 Experts available now in Live!

Get 1:1 Help Now