How to noindex in Google one page of a web site - noindex

I am interested how to prevent one page of a website to not get indexed by Google, or any other robots.
In my script i have the template with TPL files , Index.tpl , Header.tpl ....
So how do i tell google not to index page : login.tpl
Thank you

If you want a specific URL (or a directory) no not be indexes by crawlers, a simple solution is to use a robots.txt file -- which will allow you to specify what can, and cannot, be indexed.
For more informations, see About /robots.txt
For example, if you want a crawler not to index the /my-page.php URL, you could use something like this in your robots.txt file :
User-agent: *
Disallow: /my-page.php
As a sidenote : files that should not be visible from end-users (like include files, libraries, non-interpreted templates, ...) should not be served by your webserver : no-one should be available to access those.
If using Apache, using a .htaccess file in a given folder (provided this feature is enabled), you can prevent Apache from serving any file from that folder :
Deny from All
Note : nothing will be served by Apache from the directory that contains a .htaccess file with that content !

This is not correct. The robots.txt does not tell crawlers what to index and what not to index. That's what you use the meta-robots tag for. Have it serve noindex and you're good.
See for example and further reading: http://yoast.com/x-robots-tag-play/

I know i am late for the answers but this could help others also
below is the more precise answer that you will see.
I am considering that you are using wordpress for your site.
You can use wordpress "CUSTOM FIELD" option.(you can find details here)
The first thing you need to do is add the following code to the head section of your theme’s header.php template.
And copy the below code
<?php
$noindex = get_post_meta($post->ID, 'noindex-page', true);
if ($noindex) {
echo '<meta name="robots" content="noindex,follow" />';
}
?>
Now all you need to do is specify a custom field entitled noindex-page and assign a value to it. It doesn’t matter what you enter. All you need to do is ensure that something is entered in the field so that the custom field noindex-page returns as true in the code you specified in your header.
please keep this in mind, this will also work for posts

Related

How do I set the Canonical URLs in Concrete 5 to appear tidier?

I'm just starting to use C5 as a CMS, and I'm having issues with sorting out the page addresses.
If I add a page to the site, it will be visible at:
www.example.com/index.php/page
However, I find the url extremely messy, and would ideally like it to be
www.example.com/page
I'm not familiar with C5, would anyone be able to give me any pointers to change this?
Okay, After reading documentation, this can be done by enabling "Pretty URLs"
This can be achieved by:
Dashboard -> System and Settings -> SEO and Statistics -> Pretty URLs
You then get a dialogue which has a tickbox, select it and click SAVE.
C5 should be able to rewrite the .htaccess file.
If it is unable to do so, it will give you an error, and you can copy and paste the text generated in the next screen, to add to the file manually.
I see that you enabled pretty URLs on the dashboard:
http://www.yoursite.com/index.php/dashboard/system/seo/urls/
Nice work, one last step—add the following to site.php in your root/config/:
define('URL_REWRITING_ALL', true);
That'll make every URL, such as a link to a dashboard page, pretty:
http://www.yoursite.com/dashboard/system/seo/urls/
Whilst this will add friendly URL's it will not add create canonical urls, if the same page appears with various urls they will create duplicated content links.
To add a canonical link you can add the following to your header.
//Set the base url for the home page
$canonical = BASE_URL.DIR_REL;
if ($c->getCollectionId() != 1){
//Get the current URL for the page
$canonical=$nh->getCollectionURL($c);
}
//Output a canonical meta tag
printf('<link rel="canonical" href="%s" />', $canonical);echo "\n";
you can go to dashboard > Bulk SEO Updater > and change the URL here

Duplicated permalinks on a wordpress page

First I have www.mywebsite.com/blog/ Which is another wordpress Blog under www.mywebsite.com.
Then I created a page inside www.mywebsite.com which has a url of www.mywebsite.com/blog/.
I want to change the first www.mywebsite.com/blog into www.mywebsite.com/blog2 so It won't confuse me anymore.
After changing the permalinks in the admin panel. I can't access www.mywebsite.com/blog anymore.
Is there any way to access the page of the original www.mywebsite.com/blog2/wp-admin? and view the duplicated page www.mywebsite.com/blog/?
Please comments if my question confuses you.
Thanks.
When moving your site, give the guide to moving wordpress or, in this case better, the guide of changing the wordpress url a glance.
Suppose you changed the URIs where you cannot move the files, but still can access the login page (through a redirection or something) you can recover your installation easily.
wp-login.php can be used to (re-)set the URIs. Find this line:
require( dirname(__FILE__) . '/wp-load.php' );
and insert the following lines below:
//FIXME: do comment/remove these hack lines. (once the database is updated)
update_option('siteurl', 'http://your.domain.name/the/path' );
update_option('home', 'http://your.domain.name/the/path' );
run it (once) and you are done. Test your site to make sure that it works right. If the change involves a new address for your blog, make sure you let people know the new address, and consider adding some redirection instructions in your .htaccess file to guide visitors to the new location. Delete those lines from your wp-login.php.

Warning: Cannot modify header information when using require or require_once

I'm WordPress newbie.
I'm creating a plugin that redirect to custom login page each unregistered user access a website, let say the custom login page : custom_login.php.
I am able to create a code to redirect it but it seems no wordpress functions work in custom_login.php. So, I think I have to load something through the file. I guess wp-load.php.
Then I add some codes below at the top of the page :
<?php
require( 'd:\xampp\htdocs\wordpress\wp-load.php' );
?>
But then I got this error :
Warning: Cannot modify header information.....
I changed to require_once but still get similar error.
Some solutions of this forum threads advice to delete any whitespace. Frankly, I don't know what does it mean but I tried to delete all whitespace anyway so that the code become :
<?php require('d:\xampp\htdocs\wordpress\wp-load.php');?>
But it does not solve anything. The error is still exist.
Please help me, the expert ones.
Thanks in advance
Try inserting a system path relative to localhost, like this:
require( '/wp-load.php' ); // or just
require( 'wp-load.php' ); //
All depends on the location you are trying to include wp-load.php from.
On the other hand, you don't have to include wp-load.php if you place the file custom_login.php. in the stylesheet directory as a template or as a custom page. The way to do it is:
.1 Rename the file to page-custom-login.php
.2 Move the file to the stylesheet directory (The theme directory)
.3 Go to admin and create a new page with the title "custom login"
That's all. Now WP will treat that file as a single custom page.
They are correct - you have a space before the opening php tag in one of your files. It can be a bit tricky to find, but look hard.
If you can't find it, try looking for ob_clean() php function to help.

stop robot.txt on the fly creation in wordpress

I don't have a robots.txt file in my root folder but I can access it through example.com/robots.txt , it is shows this content:
User-agent: *
Disallow:
After some research on Google I learned that it is generated on the fly as my site is in wordpress. Can somebody help me stopping robot.txt on the fly creation in wordpress?
This is generated in wp-includes/functions.php, line 1845 (in 3.3.1) and you can filter the result:
echo apply_filters('robots_txt', $output, $public);
So, if you don't want it to contain anything, can you add a filter and return an empty string. WordPress uses this in response to the blog/site's privacy setting (and $public gets set to '0' if the setting is to block search engines). Hope this helps!

Wordpress Plugin to Generate non-numeric slug / permalink for posts without titles? (1 post)

I've been looking for this all over, and simply cannot find it.
I have a blog that has no titles in its blog posts, but I'd like, for various usability reasons, to have the permalinks use the first few words from entries that do not have titles as the permalink slug.
ie, if the post on sample.com/blog is
Title: (no title)
Content: Ten Easy Ways to Lose Weight
The permalink could be sample.com/blog/ten-easy-ways-to-lose-weight.
Are there any plugins that do this? For the life of me, I cannot find one. (xposted to WP support, but no one is responding)
You could enter in titles, and then not display them in your view template.
I doubt there's anything like this already built for wordpress. To get your blog to do this, you have to write a plugin that does the following:
Generates the slug while checking
for uniqueness should you ever start
more than one entry with the same words
Processes URL requests to recognize slug permalinks and then updates the query step to locate the correct post in the database. This might involve a new db table of slugs (which would also help with the uniqueness issue)
In short, WP is designed to retrieve almost everything by keys, and to support slugs like this you'd have to create a new key type.
btw: if anything is retrieved by IDs (keys), it is technically not a permalink. so, wordpress probably fails in providing true permalinks.
ps: it's not that difficult to write an handler/dispatcher that would parse URL and takle out the unique permalink and then match it to the DB by the string (not by the key!).
something like:
$url=$_SERVER["REQUEST_URI"];
echo 'URL called: ',$url,'<br />';
$dispatchfile=$dispatcher->Dispatch($url);
if ($dispatchfile)
{
echo 'launching ',$dispatchfile,' inclusion<br />';
require($dispatchfile);
}
else
{
echo 'dispatcher failed to find module, will check physical file<br />';
if (file_exists($url)) echo 'dispatcher found physical file<br />';
else echo 'nada, throw 404!';
}
You can get a permalink redirect plugin from
http://scott.yang.id.au/code/permalink-redirect/
Works fine with WP2.71
It takes the Title and auto-creates a slug from that so you would have to manually enter the slug you wanted for each page if you have a Blank Title.
You should be able to hack Scott's PHP file (it is one page only) to look up the page code and select a portion of it to use as a slug though.
In addition, I solve incorrect page requests using a .htaccess rewrite file to bring up the index page upon an incorrect page request.
Download a copy of my rewrite file here
https://oulixes.com/htaccess_example.zip
Unzip the txt file and rename as .htaccess and upload into your root directory
Hope this helps!
Cheers,
Billy

Resources