Welcome to WebmasterWorld Guest from 54.167.76.176

Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

How to do a 'global' redirect?

     

Gemini23

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

5+ Year Member



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

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

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



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

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

5+ Year Member



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

phranque

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

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



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?
 

Featured Threads

Hot Threads This Week

Hot Threads This Month