Jump to content

User Agent - Indexing PW Protected Pages


kristinaishere

Recommended Posts

Hi,

 

I have a message board where each forum is password protected so certain associations can only access their specified information.

 

Currently to access the page of the message board where they enter their password they have to look through a long list on the main part of the website- find their association name which is a hyperlink -and that takes them to the password page on the message board.

 

I want to use a Google Custom Search engine to allow them to simply search for their association name instead of showing them the long list.

 

The Custom Search would bring up the specified hyperlink name of their association.

 

However, I assume due to password protection over the pages, I am unable to get the custom search to work.

 

I read up and found that I might use a User Agent code like this:

 

$allow_inside = ($is_logged_in) || substr_count($_SERVER['HTTP_USER_AGENT'],'Googlebot');

 

Not sure where I would even put this though, or if it would work... Hoping someone has a suggestion or solution to help!

 

Thanks in advance.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/169619-user-agent-indexing-pw-protected-pages/
Share on other sites

It appears that you would want to place that in a file that is included by the rest of your application. You would want it after the session_start().

 

Maybe the message board has some sort of a bool return auth function that you can put that snippet into and then return true if Apache populates HTTP_USER_AGENT with 'Googlebot'.

 

To test, you can force $_SERVER['HTTP_USER_AGENT'] to equal whatever you want (like Googlebot) ... just be careful that Apache doesn't override it when you think it isn't.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.