Hi All, I am using new_rewrite to protect my content. I would like to ad Google AdSense onto protected pages, but can't figure out how to get it to work. For the AdSense ads to work, the google adsense web spider needs to be able to access the protected pages. How can I set this thing up to allow the google mediabot to access my pages? Thanks! Erik
Erik, please ask Google support if there is a way to detemine if it is Google mediabot accesing your pages.
I've emailed google - if it helps, I have noticed in my server logs that the user agent is called "google mediabot". Can some workaround be written for .htaccess that lets mediabot through without authentication?
Here is what I heard back from google: Hello Erik, Thank you for your email. If you would like to display Google ads on pages behind a login, you will need information about our crawlers. The user-agent 'Mediapartners-Google/2.1' is used by our crawlers when indexing content for Google AdSense. Requests from our content crawlers can come from any of the IP addresses in the following range: 66.249.64.1 - 66.249.79.254 . By allowing our crawlers to gain access to your pages behind the login, you will be able to display relevant ads targeted towards your content. Please feel free to reply to this email if you have additional technical questions or concerns. For general program or account questions, please email adsense-support@google.com. Sincerely, Mike The Google AdSense Team
Mike, edit file amember/plugins/protect/php_include/check.inc.php find lines: PHP: /* //allow access for google-bot if (preg_match('/^googlebot/i', $_SERVER['HTTP_USER_AGENT'])) return; */ add after that: PHP: if (preg_match('/^Mediapartners-Google/i', $_SERVER['HTTP_USER_AGENT'])) return; This hack will work if you are using php_include or mod_rewrite+php_include protection. If you are using another protection method, let me know which.
Thanks for the reply Alex! I am acctually using the new_rewrite plugin - can you post a hack for that? Thanks! Erik
Then hack is little more complicated. Please edit .htaccess file in your protected folder (do it via webhosting control panel -> file manager, it is usually not available via ftp). After line Code: RewriteEngine On add lines: Code: #allow access for Google MediaBot RewriteCond %{http_user_agent} ^Mediapartners-Google RewriteRule ^(.*)$ - [L]
I found this old thread today while trying to figure out how to implement AdSense on my site. I can't figure out how to get the .htaccess file edited. I downloaded it from the server to my machine and made the above mentioned edits, but the file permissions on the .htaccess file on the server will not let me overwrite it. I cant see the file in my server control panel to change the permissions, I can only access it by specifying the file name in the 'file to edit' field. But, then when I go to save it, it won't let me. It says permission denied. Does anyone know of a way to change the permissions on the .htaccess file from within amember, and if so, what should the be? 600 would be my guess. Please help! Sandi
Most filemanager systems don't show hidden files (i,e they begin with a ".") there is normally a switch in your filemanager programs that either say "view hidden files" or allow you to put "-al" in the switch field. set the permissions to allow editing. edit the file and reset permissions back to their original (DON'T FORGET to do this) IF this explanation doesn't make sense to you then best you have someone do it for you.
I understand exactly what you are saying. My FTP program (ipswitch) has no provision for viewing hidden files. Can you tell me what the permissions/ownership is supposed to be for the .htaccess file? You would think that the amember program would cause it to make me the owner with write permissions, but it wont let me modify the file. I can download it, open it for viewing in my control panel, but if I try to save a new copy I get permission denied. Is this a bug? Why don't I own the file with write permissions??? Please help. Sandi
Is this how the code in the above thread is entered at the start of the file: <?php /* //allow access for google-bot if (preg_match('/^googlebot/i', $_SERVER['HTTP_USER_AGENT'])) return; if (preg_match('/^Mediapartners-Google/i', $_SERVER['HTTP_USER_AGENT'])) return; */ If this is wrong, please show me how to do it correctly.
Hello, I am web coding newbee but, I have set my adsense account to display ads on protected pages by amember with post method; new rewirite simply by adsense account settings, only thing you need to do is ; Adsense acc->settings->check authentic locations-> (here you need to verify your protected page with webmaster tools sitemap + head or file verifyer. you have 3 options: get post .htaccess ...for new rewrite you select post with paramethers: amember_login & amember_pass and with amember script give Google his username and pass, and enter that info into above atributes, simple as that I had problems with submiting sitemap with webmastertools but have temporarly deleted .htacess file (backup it frist) then made sitemap submit, and uploaded .htacess file back. Then had no problem with linkinkg adsnese auth. link with amember protected pages.