Solved

Create an exception to a mod_rewrite using rewritecond

Posted on 2009-03-30
2
369 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Read about why website design really matters in today's demanding market.
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.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

912 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

16 Experts available now in Live!

Get 1:1 Help Now