Welcome to WebmasterWorld Guest from 50.17.5.36

Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

How to do a 'global' redirect?

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

Preferred Member

5+ Year Member

joined:Aug 30, 2007
posts: 559
votes: 3


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
3:23 am on Dec 16, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10542
votes: 8


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.
12:32 am on Dec 17, 2013 (gmt 0)

Preferred Member

5+ Year Member

joined:Aug 30, 2007
posts: 559
votes: 3


Thanks phranque... I have added numerous redirects via cpanel... seemed to be the quickest option...
1:17 am on Dec 17, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10542
votes: 8


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?