私はtxt応答を提供するlaravelを使用して動的ルートを作成しました。Googlebotが動的robots.txtを認識しない
ブラウザで動作しますが、googlebotにはrobots.txt
というファイルはありません。
これは私が取得ヘッダーです:これは私の私のlaravelルートである
Cache-Control →no-cache Connection →keep-alive Content-Disposition →inline; filename="robots.txt" Content-Encoding →gzip Content-Type →text/plain; charset=UTF-8 Date →Wed, 23 Mar 2016 11:36:44 GMT Server →nginx/1.9.12 Transfer-Encoding →chunked Vary →Accept-Encoding
:
Route::get('robots.txt', '[email protected]');
そして、これはメソッドです:
public function robots(){ return response()->view('txt.robots')->header('Content-Type', 'text/plain')->header('Content-Disposition', 'inline; filename="robots.txt"'); }
私はContent-Disposition →attachment; filename="robots.txt"
を試しましたが、Googleではrobots.txt
というファイルがないと言っています。
:
は私が
これは私のnginxの構成である(これは、ブラウザ上で動作します)Googleウェブマスターツールから動作しませContent-Disposition
や静止画を削除しようとしました、多分ここで間違って何かがあります`` `
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name mydomain.com;
root /home/forge/mydomain.com/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
# ssl_certificate_key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
index index.html index.htm index.php;
charset utf-8;
location/{
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
#location = /robots.txt { access_log off; log_not_found off; }
#location = /robots.txt {
# try_files $uri $uri/ /index.php?$args;
# access_log off;
# log_not_found off;
#}
access_log off;
error_log /var/log/nginx/mydomain.com-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
# Expire rules for static content
# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
# access_log logs/static.log; # I don't usually include a static log
}
# Feed
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
# CSS, Javascript and Fonts
location ~* \.(?:css|js|woff|ttf|eot)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
}
```
ありがとう。
'Content-Disposition'、 'inline;を削除してください。ヘッダーから。 –