Angular使用apache与谷歌分析

时间:2015-09-17 13:10:27

标签: angularjs apache google-analytics

好的,我已经尝试了几天而没有任何结果,我真的希望你们中的一些人可以帮助我。

我有谷歌没有索引我的网站的问题,这意味着它无法看到我的网站的内容。

我的网站是一个有棱角的应用程序。

所以我看到这篇文章ng-newletter说我可以使用apache所以我的配置如下:

$ a2enmod proxy
$ a2enmod proxy_http

启用代理

然后我用以下内容编辑了我的虚拟主机:

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port t$
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.

    ServerAdmin webmaster@localhost
    ServerName www.mydomain.dk
    ServerAlias mydomain.dk
    DocumentRoot /var/www/mydomain/

    RewriteEngine On
    Options +FollowSymLinks
    RewriteCond %{REQUEST_URI}  ^/$
    RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$
    RewriteRule ^(.*)$ /snapshots/%1? [NC,L]

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf


    <Directory /var/www/mydomain/>
             Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>

现在,当我尝试运行google-bot模拟器时,我得到一些奇怪的回应:

无论我去哪个网址都告诉我它已重定向回index

我现在无法在没有www.mydomain/subsite

的情况下前往404

那么我做错了什么?

谷歌的答案

    HTTP/1.1 301 Moved Permanently
Date: Thu, 17 Sep 2015 13:13:27 GMT
Server: Apache/2.4.7 (Ubuntu)
Location: http://mydomain.dk/products
Content-Length: 315
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://mydomain.dk/products">here</a>.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at www.mydomain.dk Port 80</address>
</body></html>

0 个答案:

没有答案