Solved

Problem with mod_rewrite.

Posted on 2007-03-28
1
187 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

630 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