.htaccess 如何在kohana中添加robots.txt?
我是科哈纳的新手。.htaccess 如何在kohana中添加robots.txt?,.htaccess,kohana,robots.txt,.htaccess,Kohana,Robots.txt,我是科哈纳的新手。 我正在尝试为搜索引擎索引设置robots.txt文件。 我有这个.htaccess # Turn on URL rewriting RewriteEngine On # Installation directory RewriteBase /mysite/ # Protect application and system files from being viewed RewriteRule ^(system) - [F,L] # Allow any files or
我正在尝试为搜索引擎索引设置robots.txt文件。
我有这个
.htaccess
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /mysite/
# Protect application and system files from being viewed
RewriteRule ^(system) - [F,L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteCond $1 !^(index\.php|favicon\.ico|robots\.txt)
RewriteRule ^(.+)$ index.php?kohana_uri=$1 [L]
我想将其设置为
robots.txt
文件:https://mysite.com/contact-us
我的根目录中有这种类型的robots.txt
文件:
User-agent: *
Disallow: /contact-us/
Sitemap: https://mysite.com/sitemap.xml
但当我在谷歌的mysite中搜索时,我会显示这个页面。mysite.com就是一个例子。
如何在索引中隐藏此内容?
谢谢行
禁止:/contact-us/
将阻止路径以/contact-us/
开头的所有URL
因此,它会阻止,例如,http://example.com/contact-us/
,但不是http://example.com/contact-us
(不带尾随斜杠)
因此,如果要阻止http://example.com/contact-us
,您应该使用:
Disallow: /contact-us