Hi,

I want to do a 301 redirect for one of my pages. What I was wondering is am I still able to execute php code on the same page of the 301 redirect?

If so how?

So far I haven't had luck...

Thanks.

Recommended Answers

All 4 Replies

There are a number of ways to do this. You haven't posted any code or provided specifics. If you use a Meta Refresh to do the re-direct, you should be able to include other code in the same module.

There are a number of ways to do this. You haven't posted any code or provided specifics. If you use a Meta Refresh to do the re-direct, you should be able to include other code in the same module.

Thanks for your reply :)

This is the code:

<?PHP 
include "test.php"; 


?>

and

<?PHP


header("HTTP/1.1 301 Moved Permanently");
header("Location: http://sampleplace.com/");
exit();

?>

Is there no way to use 301 redirect? As I prefer using it...due to it's SEO capabilities

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.