.htaccess中的X

编程入门 行业动态 更新时间:2024-10-21 16:33:36
本文介绍了.htaccess中的X-Robots noindex特定页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我可以使用.htaccess中的x个机器人 noindex,跟随特定页面吗?

Can I 'noindex, follow' a specific page using x robots in .htaccess?

我找到了一些有关noindexing文件类型的说明,但是我可以

I've found some instructions for noindexing types of files, but I can't find instruction to noindex a single page, and what I have tried so far hasn't worked.

这是我想要的noindex页面:

This is the page I'm looking to noindex:

www.examplesite.au/index.php?route=news/headlines

这是我到目前为止尝试过的:

This is what I have tried so far:

<FilesMatch "/index.php?route=news/headlines$"> Header set X-Robots-Tag "noindex, follow" </FilesMatch>

感谢您的时间。

推荐答案

似乎无法从.htaccess文件中匹配请求参数。以下是可以与之匹配的列表: httpd.apache/ docs / 2.2 / sections.html

It seems to be impossible to match the request parameters from within a .htaccess file. Here is a list of what you can match against: httpd.apache/docs/2.2/sections.html

在脚本中执行此操作会容易得多。如果您使用的是PHP,请尝试:

It will be much easier to do it in your script. If you are running on PHP try:

header('X-Robots-Tag: noindex, follow');

您可以轻松地在$ _GET,REQUEST_URI等上建立条件。

You can easily build conditions on $_GET, REQUEST_URI and so on.

更多推荐

.htaccess中的X

本文发布于:2023-11-01 18:17:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550060.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!