Title: block search engine from certain page using php script
Last modified: August 20, 2016

---

# block search engine from certain page using php script

 *  [Bhiroe](https://wordpress.org/support/users/bhiroe/)
 * (@bhiroe)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/block-search-engine-from-certain-page-using-php-script/)
 * I want to create a page that can not be visited by search engine bots, but I 
   just want to use php script to block it, is there anything that can help me ………..

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Jam Viet](https://wordpress.org/support/users/mcjambi/)
 * (@mcjambi)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/block-search-engine-from-certain-page-using-php-script/#post-2143432)
 * using this code in the loop like:
    if (is_page()) { $something = $_SERVER[‘HTTP_USER_AGENT’];
   if(preg_match(‘/google/i’, $something)) { wp_redirect(home_url(‘/’)); }
 * }
 *  Thread Starter [Bhiroe](https://wordpress.org/support/users/bhiroe/)
 * (@bhiroe)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/block-search-engine-from-certain-page-using-php-script/#post-2143614)
 * thank’s **mcjambi**
    but I don’t know how to apply on my 404 page, this is my
   404 page:
 *     ```
       <div class="hentry post 404">
       	<h1><?php _e('Not Found', 'default'); ?></h1>
       	<div class="entry">
       		<p><?php _e('Apologies, but we were unable to find what you were looking for. Perhaps  searching will help.', 'default'); ?></p>
   
       		<?php get_search_form(); ?>
   
       		<p>&raquo; <a href="<?php bloginfo('url'); ?>"><?php _e('Or go to the homepage', 'default'); ?></a></p>
       	</div>
       </div>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘block search engine from certain page using php script’ is closed to 
new replies.

## Tags

 * [bot](https://wordpress.org/support/topic-tag/bot/)
 * [UserAgent](https://wordpress.org/support/topic-tag/useragent/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [Bhiroe](https://wordpress.org/support/users/bhiroe/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/block-search-engine-from-certain-page-using-php-script/#post-2143614)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
