【问题标题】:Use htaccess to remove any sub directories in URL使用 htaccess 删除 URL 中的所有子目录
【发布时间】:2014-10-08 19:21:53
【问题描述】:

我运行一个表达式引擎站点,该站点将加载一个文章页面,而不管在地址栏中键入任何组成的子目录名称。

例如所有这些地址:

http://hellothere.example.com/health/mental/depression
http://cats.example.com/health/mental/depression
http://dogs.example.com/health/mental/depression
http://www.batman.example.com/health/mental/depression
http://www.1.2.3.4.5.6.example.com/health/mental/depression

将加载example.com/health/mental/depression

显然,这对于 SEO 来说不太理想,因为我可能有无限数量的重复 URL。

我正在尝试弄清楚如何使用 htaccess 在 example.com 之前删除任何内容并将其替换为 www。

任何帮助将不胜感激!

【问题讨论】:

    标签: apache .htaccess mod-rewrite redirect expressionengine


    【解决方案1】:

    你不能用 htaccess 做到这一点。这样做的方法是设置通配符 dns 记录,以便所有请求 (*.example.com) 都定向到同一服务器。

    http://codex.wordpress.org/Configuring_Wildcard_Subdomains

    【讨论】:

      猜你喜欢
      • 2012-06-25
      • 2021-06-24
      • 2013-05-18
      • 2020-05-11
      • 1970-01-01
      • 1970-01-01
      • 2013-08-18
      • 2013-05-28
      相关资源
      最近更新 更多