【问题标题】:Redirect all url's with htaccess使用 htaccess 重定向所有 url
【发布时间】:2012-04-04 14:22:27
【问题描述】:

我被这个问题困扰了一段时间。但是我想将我所有没有#的页面重定向到带有#的URL,请参见下面的示例。此示例适用于一页,但我想一次性为我的所有页面获取此示例。

RewriteEngine on 
Redirect permanent /index.php/artikel/contact http://www.mydomain.com/#index.php/artikel/contact

有没有办法插入变量或类似的东西,所以我不必一个一个地插入我的网址?

再次感谢您的宝贵时间。

【问题讨论】:

  • 希望您了解带有# 的URI 甚至无法到达Apache。这一切都在浏览器中处理。

标签: .htaccess redirect


【解决方案1】:

您想使用 mod_rewrite。 http://httpd.apache.org/docs/current/mod/mod_rewrite.html

然后,您可以使用 paringin 来代替使用 Redirect 指定每个 url(甚至可能不需要重写引擎)

RewriteCond
RewriteRule

使用正则表达式指定条件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-05
    • 1970-01-01
    • 2014-08-14
    • 1970-01-01
    相关资源
    最近更新 更多