Solved

Regular expression help needed

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
script that sorts the lines in file according to integer in line 7 26
idM Identity Management in Red Hat 6 - setting up 9 264
inotifywait in linux 2 280
Linux Search 3 66
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 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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

20 Experts available now in Live!

Get 1:1 Help Now