Solved

Problem with mod_rewrite.

Posted on 2007-03-28
1
181 Views
Last Modified: 2010-03-04
Need some help with mod_rewrite... Can not seem to get this to work.

RewriteCond %{REQUEST_URI} ^/foo/one|two|three/.+$ [NC]
RewriteRule ^/foo/(a-z)/?$ "/press/$1/bar" [NC]

Trying to say... if someone goes to /foo/(either one, two, or three)/
then go to /foo/x/bar

Perhaps it could all be done without a RewriteCond
0
Comment
Question by:qwertq
[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
1 Comment
 
LVL 11

Accepted Solution

by:
JamesCssl earned 250 total points
ID: 18812905
RewriteRule ^/?foo/(one|two|three)/bar/?$ /foo/$1/bar [NC]


In your initial RewriteCond, You needed parenthesis to set off the middle section like:
RewriteCond %{REQUEST_URI} ^/foo/(one|two|three)/.+$ [NC]
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Suggested Solutions

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

738 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