Ich habe eine dynamische Route mit Laravel erstellt, die eine txt-Antwort liefert.Googlebot erkennt dynamische Robots nicht.txt
Es funktioniert auf den Browser, aber Googlebot sagt, dass es keine robots.txt
Datei gibt.
Dies ist der Header, die ich bekomme:
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
Das ist meine meine Laravel Route:
Route::get('robots.txt', '[email protected]');
Und das ist die Methode:
public function robots(){ return response()->view('txt.robots')->header('Content-Type', 'text/plain')->header('Content-Disposition', 'inline; filename="robots.txt"'); }
Ich versuchte mit Content-Disposition →attachment; filename="robots.txt"
, aber Google sagt immer wieder, dass es keine robots.txt
Datei gibt.
Ich habe versucht, das Content-Disposition
und Stills nicht funktioniert von Google Web Master-Tool (Es funktioniert im Browser)
Das ist meine nginx Konfiguration, vielleicht zu löschen ist etwas nicht in Ordnung hier:
`` `
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";
}
}
```
Vielen Dank.
Versuchen Sie, "Content-Disposition", "Inline" zu entfernen; aus dem Header. –