ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm helping with a website which uses an "Add to Cart" button which is a link to a php script with GET variables which updates the cart and then uses header("Location: whatever.html"); to return the user to the original page. We need to prevent google from listing this link in search results. I've read that using rel="nofollow" only causes the link to not carry any weight-- but doesn't actually exclude from the index. Is there any way to keep robots--specifically google-- from indexing those links?
You can use a robots.txt file or meta tag. Google, like all well behaved indexing services honors them. The meta tag you are looking for is specifically:
Right, but there are two problems. The specific file I don't want listed is update.php in the cart folder. The robots.txt blocks /cart/ from being crawled, however, since there are links to /cart/update.php in the main site, those are being indexed. Say /index.html has a link to /cart/update.php?add_item=123. Google then adds /cart/update.php?add_item=123 to it's search results.
I can't use a META tag in update.php as it doesn't have any output and thus nowhere to put a META tag. It updates a session variable and returns to /index.html using header("Location: index.html"); PHP function.
Thank you. However, I already have /cart/ blocked in robots.txt. The links still get indexed though because they are linked from pages on the home page. So the page doesn't get crawled via /cart/, but still gets listed in search engine results.
ah. so even if you specify a particular filename (update.php) it still crawls it since there is an external link? or because of the ?xxx params on the url?
Well, I suppose both of those reasons. I'm not entirely sure how it works. But I know that even though it's not be crawled, it's still being listed in the google search.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.