Solved

Create an exception to a mod_rewrite using rewritecond

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can't connect to WAMP server 5 54
Backup Raspberri Pi over the netowrk to a Windows Share 5 42
PHP Form Calculate Total Price 10 43
Upgrade BIOS / EUFI at Scale 4 37
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

803 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