homepage Welcome to WebmasterWorld Guest from 54.196.196.108
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 / WordPress
Forum Library, Charter, Moderators: lorax & rogerd

WordPress Forum

    
How to do a 'global' redirect?
Gemini23




msg:4630927
 10:01 pm on Dec 15, 2013 (gmt 0)

I have a WordPress installation... with several hundred posts...

the WordPress installation folder has been renamed and all has worked successfully...

BUT.... for any users that have bookmarked or backlinked... how do I set up a 'global' redirect from ALL of the posts under the old folder to the new one? (to prevent broken links etc)

ie... domainxyz.com/blog/file12345
to redirect to domainxyz.com/newname/file12345

 

phranque




msg:4630992
 3:23 am on Dec 16, 2013 (gmt 0)

assuming you are on apache and don't have access to the server config file, you probably want something like this in your .htaccess file of the root directory:
RewriteRule ^blog/(.*)$ http://example.com/newname/$1 [R=301,L]

however, where you put this directive and whether it is correct as is depends on what else you have going on in your configuration and where.

there may be a WP plugin that would handle these external redirects for you.
if you need more Apache mod_rewrite help, you should post your relevant directives there for discussion.

Gemini23




msg:4631351
 12:32 am on Dec 17, 2013 (gmt 0)

Thanks phranque... I have added numerous redirects via cpanel... seemed to be the quickest option...

phranque




msg:4631360
 1:17 am on Dec 17, 2013 (gmt 0)

if cpanel implements these redirects using mod_alias it won't work well with the mod_rewrite directives that are surely in place for WP to work.

do you have hostname canonicalization redirects in place?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / WordPress
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