I would like to make a php 301 redirect based upon if else statement.
I have 2 categories and would like pages within category 2 redirect to another url.
Is it possible to have all pages of category 2 redirect from domain1.com to domain2.com?
So also :::: domain1.com/pagetitle.html to domain2.com/pagetitle.html?
I have the following, but it doesnt seem to work. The in_category is okay, but the redirect is only the base url domain2.com and not domain2.com/pagetitle.html:
<strong>----------------- EDIT ------------------------------------</strong>
This is still driving me crazy...
I have the following, but firefox says there is a problem while loading through some cookies.
Is this the right markup??
<a href="http://rphgoossens.files.wordpress.com/2010/06/screenshot-problem-loading-page-mozilla-firefox.png" rel="nofollow">SEE THIS IMAGE</a> of what I get redirected too.
I have 2 categories and would like pages within category 2 redirect to another url.
Is it possible to have all pages of category 2 redirect from domain1.com to domain2.com?
So also :::: domain1.com/pagetitle.html to domain2.com/pagetitle.html?
I have the following, but it doesnt seem to work. The in_category is okay, but the redirect is only the base url domain2.com and not domain2.com/pagetitle.html:
Code:
if (in_category('2') ){
Header( "HTTP/1.1 301 Moved Permanently" );
header('Location: http://www.markett.nl' . $url_suffix . '/' . $url, true, 301);
} else { }
<strong>----------------- EDIT ------------------------------------</strong>
This is still driving me crazy...
I have the following, but firefox says there is a problem while loading through some cookies.
Is this the right markup??
Code:
<?php $category = get_the_category();
$url = $_SERVER['REQUEST_URI'];
// Redirect to correct site on basis of section id
if(in_category('2') ){
header('Location: http://www.domain2.com/' . $url, true, 301);
exit; }
?>
<a href="http://rphgoossens.files.wordpress.com/2010/06/screenshot-problem-loading-page-mozilla-firefox.png" rel="nofollow">SEE THIS IMAGE</a> of what I get redirected too.