?
Solved

Create an exception to a mod_rewrite using rewritecond

Posted on 2009-03-30
2
Medium Priority
?
375 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
[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
2 Comments
 
LVL 27

Accepted Solution

by:
caterham_www earned 2000 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

765 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