Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-02-2012, 12:45 PM   PM User | #1
Erve
New Coder

 
Join Date: Oct 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Erve is an unknown quantity at this point
Conditional Rewrite not Working

I'm struggling to get my conditional rewrite working....

Basically, I'm trying to rewrite old WP permalinks, but exclude the uploads folder from the rewrite.

So http://www.mydomain.com/2011/02/mypost/ becomes http://www.mydomain.com/mypost/.

BUT

http://www.mydomain.com/wp-content/uploads/2011/02/mypicture.jpg does not change.

The code I have so far is:
Code:
RewriteEngine on


RewriteCond %{REQUEST_URI} !^/robots\.txt$ [NC]
RewriteCond %{HTTP_HOST} !^www\.[a-z-]+\.[a-z]{2,6} [NC]
RewriteCond %{HTTP_HOST} ([a-z-]+\.[a-z]{2,6})$   [NC]
RewriteRule ^/(.*)$ http://%1/$1 [R=301,L]


RewriteCond %{REQUEST_URI} !^/wp-content/uploads
RewriteRule /([0-9]+)/([0-9]+)/(.*)$ http://www.mydomain.com/$3
But it's not working.... Would be really grateful if someone can tell me where I'm going wrong!!!
Erve is offline   Reply With Quote
Old 03-04-2012, 12:09 PM   PM User | #2
Erve
New Coder

 
Join Date: Oct 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Erve is an unknown quantity at this point
Does no-one have any ideas?
Erve is offline   Reply With Quote
Reply

Bookmarks

Tags
conditional, exclude, htaccess, rewrite

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:40 AM.


Advertisement
Log in to turn off these ads.