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
2010-01-02 22:34:21
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
2010-01-02 22:38:05
+1
A:
add_action('init', 'redirect_home');
function redirect_home() {
if( is_home() ) {
wp_redirect('http://example.com');
}
}
That should do it.
nickohrn
2010-01-02 23:37:44
nickohrn, where do I add the code you provided ?
ben
2010-01-02 23:48:15
functions.php for your active theme.
nickohrn
2010-01-03 00:31:43
it didn't work for me usin the wordpress Classic theme(grey//white colors). Does t work for you?
ben
2010-01-04 21:49:07