I have a page using a pretty url and a mod_rewrite rule matching it. I expected it to give an error but it’s working. Why?

this may seem like a weird question but I have something working and I don’t understand how.

I have moved my wordpress install to a subdirectory and am using the .htaccess file to redirect anything that is not in another folder A to the blog folder B.

Read More
RewriteCond %{REQUEST_URI} !^/A/.*$
RewriteRule .* B/$0  [L]

I am also using the Webphysiology Portfolio plugin and am calling the shortcode for it in a page called Portfolio. The images displayed by the plugin have their path set in the form /portfolio/wp-content/rest-of-url-etc (which is not the actual physical path) and this was causing problems with displaying them in the lightbox which could not find the images.

To fix this I added a rule before the other one:

RewriteCond %{REQUEST_URI} ^/portfolio/(.*)$
RewriteRule .* B/%1  [L]

This fixed the lightbox problem as expected but after fixing it I thought it will mess up my portfolio page display which has the path /portfolio/ and hence matches this rule.

But it is working. Can anybody please explain why?

AS

Related posts

Leave a Reply