Solved

Regular expression help needed

Posted on 2004-09-14
3
238 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

815 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

13 Experts available now in Live!

Get 1:1 Help Now