homepage Welcome to WebmasterWorld Guest from 54.237.213.31
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

    
301 Redirect from old domain to new domain with different permalink
301 Redirect from old domain to new domain with different permalink structu
mcmedal001



 
Msg#: 4664648 posted 10:46 am on Apr 21, 2014 (gmt 0)

Hello, I just moved all post from my old domain at http://www.example.net to a new one at http://www.example.com.

I tried to do a 301 redirect but it didn't work out fine. Only the homepage redirects. Every other page redirects to the new site but brings the 404 error page.

The permalinks structure for example.net is a custom one that looks like this http://www.example.net/147/how-to-configure-and-get-2go-to-work-on-your-blackberry.html (the 147 at the end of the domain is post-id) while the one on example.com is one of the defaults in WordPress.

To make it clearer, I used [/%post_id%/%postname%.html] permalinks structure on example.net and I want to use [/%postname%/] structure on example.com.

I tried the redirection using .htaccess with the following code
# BEGIN WordPress
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example.net$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
# END WordPress

Please, how can I make the redirect work? Thanks in advance.

[edited by: Ocean10000 at 9:22 pm (utc) on Apr 21, 2014]
[edit reason] examplified [/edit]

 

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4664648 posted 3:38 pm on Apr 21, 2014 (gmt 0)

Before anything else: Look for a WP plugin that does what you want. There probably is one already.

Do the old site and new site live in the same directory on the same server? The redirect has to be in a location where it will be seen by requests for the old domain.

If the old and new sites use different URL structures, you will also need a way to tell this to WP-- either through a plugin or with hand-written rules.

mcmedal001



 
Msg#: 4664648 posted 6:15 pm on Apr 21, 2014 (gmt 0)

I have tried several plugins that did not work. I am not very vast in writing .htaccess rules. I gave the simple example I know in my original post.

The old site and new site are on the same host but different servers. The homepage rediretion works fine but the internal links bring 404 error.

I need help from experts here. Thank you.

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4664648 posted 9:17 pm on Apr 21, 2014 (gmt 0)

The homepage rediretion works fine but the internal links bring 404 error.

We're going to need more information. A redirect has two parts:
#1 the original request that meets a 301 response
#2 the new request for the page named in the redirect
So a 404 can arise in two ways: either because the redirect didn't happen (404 at original URL), or because the redirect points to a nonexistent page (404 at new URL).

Since we're talking about redirects rather than rewrites, you don't need any special tools to identify the problem. Just look at the browser's address bar.

If the two sites are on different physical servers (host* doesn't matter), all redirects need to be in the htaccess that covers the old site. Nothing should happen on the new site except the final WP rewriting.

At a guess: the redirects are capturing the original request and attaching it to the new domain name. But the new domain has a different URL structure, so WP doesn't know how to convert the old URL into a new page. But that's only a hypothesis. We need more information from you.


* Here I assumed you mean "host" as in "the entity you write your checks to", not "host" as in "domain".

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