views:

48

answers:

4
+1  Q: 

main url redirect

is it possible to have the main domain of a wordpress blog(example.com) to redirect to another site and the actual posts and pages (example.com/post1, example.com/about, etc') to not be redirected and instead reside on the wordpress?

A: 

You could do that with mod_rewrite:

RewriteEngine on
RewriteRule ^$ http://other.example.com/ [L,R]

This example is for the .htaccess file in the document root directory and will redirect requests to other.example.com.

Gumbo
A: 

You could also look at using the WordPress redirection function in place of the header location..

wp_redirect('someurl', 301);

301 is the status code to use, and of course someurl is where you'd place your URL to reirect to.. (301 is default, so not required unless you want a difference status code)

streetparade
+1  A: 
add_action('init', 'redirect_home');
function redirect_home() {
  if( is_home() ) {
    wp_redirect('http://example.com');
  }
}

That should do it.

nickohrn
nickohrn, where do I add the code you provided ?
ben
functions.php for your active theme.
nickohrn
it didn't work for me usin the wordpress Classic theme(grey//white colors). Does t work for you?
ben
A: 

nickohrn, where do I add the code you provided ?

ben