Setting up a redirect from 'www.example.com' to 'www.mysite.com/blog'

Setting up a redirect from 'www.example.com' to 'www.mysite.com/blog' - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Setting up a redirect from 'www.example.com' to 'www.mysite.com/blog' error on your web browser. Problem :


hopefully someone can give me a roadmap to get this done.



I run a self-hosted Wordpress blog at



http://www.example.com



which has numerous posts/links such as



http://www.example.com/videos/this-is-post-23/
http://www.example.com/pictures/this-is-post-34/
http://www.example.com/news/this-is-post-67/



I am now planning in moving to a new domain, http://mysite.com.



I would like to move my content into mysite.com as follows:



http://mysite.com/blog/videos/this-is-post-23/
http://mysite.com/blog/pictures/this-is-post-34/
http://mysite.com/blog/news/this-is-post-67/



My sense is that a 301 redirect will not suffice and wonder if changes elsewhere (htaccess?) are needed to make this move without screwing up my pagerank (currently 5).



Any ideas or suggestions? My server is LAMP.



Thanks for helping!


Solution :

301 Redirect is exactly what you need. You new URL (on new site) has single & very small constant/persistent difference: new URL has /blog in front of old URL.



As simple as:



Redirect 301 / http://mysite.com/blog/


The same but using mod_rewrite:



RewriteEngine On

RewriteRule (.*) http://mysite.com/blog/$1 [R=
301,L]


Any of these rules should be place in .htaccess in website root folder on www.example.com site and placed before WordPress rewrite block.



The "bad" thing -- is that requests for images and other static resources (on old site) are also will be redirected .. and if they are located in a different location (not in /blog folder), you may have quite a few 404 hits on your new site (that's if someone will be requesting those resources directly, which should not happen under normal circumstances).


We hope that this article has helped you resolve the wordpress, htaccess, redirects error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=