homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Rewrite directory path when old directory still in URL

 4:48 pm on Oct 14, 2013 (gmt 0)

Don't know if the title is clear, but basically I'm a bit afraid of causing some sort of redirect loop, so wanted to get a bit of advice.

Essentially, I've changed the location of a WP install

Old URL:


However, the slug for the blog page on the new install is 'blog'

So, its url is:

Which makes me apprehensive just redirecting /blog/ to /newname/
as it'll probably end up going around in circles.

At a push, I could alter the slug, but would rather not. How to rewrite?



 7:04 pm on Oct 14, 2013 (gmt 0)

use a regular expression that precisely matches that pattern.

what have you tried?


 9:49 pm on Oct 14, 2013 (gmt 0)

You need a RewriteCond to exclude requests that have already been rewritten. What does your existing rule look like?


 12:20 am on Oct 15, 2013 (gmt 0)

You should be fine as long as you start-anchor the blog [RewriteRule ^blog/] and make sure you're redirecting external requests, but ignoring internal requests if they're using the same path via a RewriteCond with %{THE_REQUEST}

The use of a condition and the_request actually depend on the exact situation you're dealing with, so they may be unnecessary, but the only way to know for sure is to have the specifics, which means, as phranque and Lucy24 are asking, I have to ask: what do your existing rules look like and what have you already tried?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved