Jump to content

php header


jose07

Recommended Posts

Hey guys,

 

I have a problem, i'm using ob_start to send multiples headers and it works but the problem is that my metada is not being sent, when i remove the ob_start it gets sent. Is there a way i can allow more info to be sent with ob_start? or should i use other methods to redirect to pages? i dont want to use javascript or meta http because they are not very reliable is there any other way?

Thanks for help.

Link to comment
Share on other sites

i have a page that allows users to see the contents of it only if they are logged in, so it checks for that and re-directs them accordingly (two header locations, welcome page or sign in page) if i don't use ob_start i get error 'headers already sent' because i believe it starts from other scripts(i have one for a header where all metadata is stored/retrieved from db).

 

When i used ob_start i don' t get the errors and the re-direction works fine, however, my metadata is not sent google doesn't find my tags and is this extra info thats not being sent. I've tried to add ob_end_flash but it doesn't seem to help. Hope that makes sense

Link to comment
Share on other sites

hmmn i don't know if you understand what i'm writing? I'm not redirecting people to a different site, only to log in page if they're not logged in. Example: If i look for 'php forums' on google 'phpfreaks' will come up because the metadata and tags 'php,forum' are associated with phpfreaks but it doesn't mean i can post without registering and because i haven't registered doesn't mean google won't find you when i do a search? and when i get to phpfreaks i'm redirected to a log in or subscribe page.

Now the content that users can see(on my site) once logged in have tags associated with them that google should index but its not doing at the moment because it can't find it. ob_ is stopping that info flow

Does it make sense now?

Link to comment
Share on other sites

It makes perfect sense. Always did. The difference is we do not redirect users to a login page if they are not logged in and are trying to access our index. This is what you seem to be doing.

 

Google cannot index pages it can't access, eg, it cannot index our admin pages because it can't login. If you want your pages to be open to Google they need to be open to the public.

 

Now, 1 more time. You cannot send data to the browser and then send headers.

Link to comment
Share on other sites

Ok, users can easily access my index and my index is also easily found on google. i have articles in different categories, some articles are free to see and others the user has to log in to see.

 

I understand your point but note that If i use javascript to redirect the user my metadata works, even if the user has javascript disabled they won't see the article and will still have to log in. I guess this works because i'm not sending headers? I didn't want to use javascript but i guess if using headers will stop the metadata then i'll use java for now until i figure a work around headers or php is improved. What do you think, suggest?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.