Solved

Create an exception to a mod_rewrite using rewritecond

Posted on 2009-03-30
2
371 Views
Last Modified: 2012-06-21
Okay, so I have this mod rewrite that checks to see if a folder or file exists, then if not, converts the URL into a string that gets sent to index.php. This is working great, I just want to create an exception that when it detects anything with /wp as in /wp/category/ or /wp/about, pretty much anything that starts with /wp, it will not execute the rule. Below is the version that works and the versions I tried to do.
// this works
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
 
#SEFU
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?url=%{REQUEST_URI} [L,NE]
 
// this is my attempt that didn't work
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
 
#SEFU
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/wp/
RewriteRule .* index.php?url=%{REQUEST_URI} [L,NE]

Open in new window

0
Comment
Question by:MeridianManagement
2 Comments
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
ID: 24027258
You can't use the lexicographical eq. operator (=) if you'd like to match /wp/foo. =/wp/ will only match /wp/ but not /wp/anything:
// this is my attempt that didn't work
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
 
#SEFU
RewriteCond %{REQUEST_URI} !^/wp/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.* index.php?url=%{REQUEST_URI} [L,NE]

Open in new window

0
 
LVL 2

Author Closing Comment

by:MeridianManagement
ID: 31564679
thank you!!
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn how to dynamically set the form action using jQuery.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

828 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