943,754 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 446
  • PHP RSS
Feb 16th, 2009
0

Redirect

Expand Post »
Hi,

I am using redirect on my index.php to redirect to a directory in server. I havent used any html tags etc just <?php redirect ?>
i want to use html meta data and tags as well.

as i am a newbie i need your help on this. because google cannot crawl and create the sitemap. help please

thanks
Similar Threads
Reputation Points: 10
Solved Threads: 1
Posting Whiz
sam1 is offline Offline
300 posts
since Nov 2004
Feb 16th, 2009
0

Re: Redirect

Not sure exactly what you are asking, but in PHP redirection can be done as follows:
php Syntax (Toggle Plain Text)
  1. <?php
  2. header("Location:http://www.somesite.com");
  3. ?>
and Meta:
PHP Syntax (Toggle Plain Text)
  1. <meta http-equiv="refresh" content="5; url=http://www.somesite.com">
this goes in the <head> tag
Reputation Points: 96
Solved Threads: 124
Master Poster
Will Gresham is offline Offline
728 posts
since May 2008
Feb 16th, 2009
0

Re: Redirect

thanks for the reply. basically i have a php file but when i include html tags the redirect doesnt work. what should i do to make it work .

should i create .html file and have html tags then redirect using php or this php file is fine.......
Reputation Points: 10
Solved Threads: 1
Posting Whiz
sam1 is offline Offline
300 posts
since Nov 2004
Feb 16th, 2009
0

Re: Redirect

You can either echo the HTML tags echo "<some_tag>html</some_tag>"; If you do this the remember to escape your quotes with \s

Or another way:
php Syntax (Toggle Plain Text)
  1. <?php
  2. // Some PHP code
  3. ?>
  4. some HTML code
  5. <?php
  6. // Some more PHP code
  7. ?>
Reputation Points: 96
Solved Threads: 124
Master Poster
Will Gresham is offline Offline
728 posts
since May 2008
Feb 16th, 2009
0

Re: Redirect

Quote originally posted by sam1 ...
when i include html tags the redirect doesnt work
Very true. You can't send header information (thats where you're redirecting) after outputting anything. All you could do is put your meta tags after the redirection code. That would be useless though, because your program will never get to this point.
Reputation Points: 128
Solved Threads: 43
Posting Whiz
death_oclock is offline Offline
389 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC