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

    
Another 301 Redirect Question.
imbckagn

5+ Year Member



 
Msg#: 4378120 posted 9:16 pm on Oct 22, 2011 (gmt 0)

I searched and couldn't find my answer.

I am trying to .htaccess 301 redirect and entire website to the index of a new website. So basically I want every page of the old website pointing to the index page of my new website.

I though this would be easy and this is what I'm using:

Redirect 301 / http://www.site.org/

Both websites are using Wordpress. When I visit any URL of the old website excluding the index it takes me to a 404 page on the new website instead of the index page.


Thanks in advance.

 

lucy24

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



 
Msg#: 4378120 posted 10:16 pm on Oct 22, 2011 (gmt 0)

You need to get a firm grip on the difference between mod_alias (what you're using here) and mod_rewrite.

One key difference: Redirects made using mod_alias will reappend the rest of the path. So when you say

Redirect 301 / http://www.example.com/

it really means

Redirect 301 {/blahblah} http://www.example.com{/sameblahblah}

There are times when mod_alias is appropriate* but what you want here is

RewriteEngine On

RewriteRule .* http://www.example.com/ [R=301,L]


* Apache says so. [httpd.apache.org]

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4378120 posted 10:24 pm on Oct 22, 2011 (gmt 0)

SEO wise, it is generally bad form to funnel multiple pages via a redirect to a single target URL, especially so if that target is the root.

Much better would be a one-to-one 301 redirect of old page to equivalent new page.

imbckagn

5+ Year Member



 
Msg#: 4378120 posted 10:36 pm on Oct 22, 2011 (gmt 0)

Thanks lucy24 but I should have mentioned I tried what you suggested and:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) [newdomain.com...] [R=301,L]

Neither of these options work and both product the same result described in my original post.

g1smd there are no equivalent pages on the new site. I'm killing the whole site and want to funnel all the traffic to the index of the new site.

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4378120 posted 10:42 pm on Oct 22, 2011 (gmt 0)

Use example.com on this forum to stop URL auto-linking.

The RewriteRule code should have worked exactly as you wanted. Is mod_rewrite enabled on that server?

You don't need to pay for two hosting plans. Point both domains at the one server. Install a redirect so that when the request is for the wrong hostname, the server sends a redirect to the correct hostname. When the new request arrives at the same server, but this time for the right hostname, the content is served.

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