Problem with mod_rewrite.

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
Who is Participating?
JamesCsslConnect With a Mentor Commented:
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]
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.