【问题标题】:RewriteRule for SEO in a SPA not workingSPA 中 SEO 的 RewriteRule 不起作用
【发布时间】:2013-03-28 07:59:48
【问题描述】:

我希望为我的单页应用程序网站实施 SEO(假设它位于 www.myexample.com)

在阅读了 Google 的文档 (https://developers.google.com/webmasters/ajax-crawling/docs/getting-started) 之后,我开始尝试在网站的主页上进行此操作。 这意味着, www.myexample.com?_escaped_fragment_= 应该“映射到” www.myexample.com/staticIndex.html

我在网站的 public_html 文件夹中的 .htaccess 文件中添加了以下内容:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=
RewriteRule ^_escaped_fragment_= /staticIndex.html [PT]

在此更改之后,当我在浏览器中尝试 URL www.myexample.com?_escaped_fragment_= 时,我希望浏览器向我显示文件 staticIndex.html 的内容 相反,它向我显示 www.myexample.com (index.html) 的内容,并且浏览器 URL 保持不变为 www.myexample.com?_escaped_fragment_=

有人可以帮我改写规则吗?

谢谢。

【问题讨论】:

    标签: apache seo


    【解决方案1】:

    试试这个:

    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^_escaped_fragment_=$
    RewriteRule (.*) staticIndex.html [PT]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-21
      相关资源
      最近更新 更多