PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Can't Use header to Redirect (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Can't Use header to Redirect


#5894
cyrix (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Can't Use header to Redirect 11 Months, 1 Week ago Karma: 0  
I want to redirect my visitors to a new URL when the click on an article, so I tried this with DirectPHP in my article.

<?php header('Location: http://google.com'); ?>


But it gives me an Parse error: syntax error, unexpected '"' in xxxxxxxxxxxxxxxxxx\plugins\content\DirectPHP\DirectPHP.php(58) : eval()'d code on line 1


May I know why? How can we use DirectPHP to do a simple URL redirection?

Thank you.
 
  The administrator has disabled public write access.

#5895
kksou (Admin)
Admin
Posts: 1694
graph
User Online Now Click here to see the profile of this user
Re:Can't Use header to Redirect 11 Months, 1 Week ago Karma: 27  
Hi,

The DirectPHP is a content plugin. As the name suggests, it's for use within a Joomla article.

As such, by the time the plugin is being processed, the page header has already been output by the Joomla framework. Think that's why you receive errors when you try to output any header.

If you just want to redirect, why don't you do a 301 redirect in your .htaccess file?

Regards,
/kksou
 
  The administrator has disabled public write access.

#5896
cyrix (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:Can't Use header to Redirect 11 Months, 1 Week ago Karma: 0  
Thanks a lot for your reply.
Since my editors may not have access to .htaccess.

Probably I will use META or JS redirect within the article.
 
  The administrator has disabled public write access.



Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2012. kksou.com. All Rights Reserved