【问题标题】:htaccess how to rewrite url if url exists string如果url存在字符串,htaccess如何重写url
【发布时间】:2017-10-10 13:06:53
【问题描述】:

当 URL 包含某个字符串时,我想用 htaccess 重写我的 url。

例子:

My url : example.com/information

当“信息”在我的 url 中时,我想重写我的 information.php 文件。 希望有人能帮帮我。

【问题讨论】:

标签: .htaccess url url-rewriting


【解决方案1】:

试试这个:

RewriteCond %{REQUEST_URI} !/information\.php$
RewriteRule information information.php [L]

此规则会将任何在 URL 路径中包含“信息”的请求重写为同一目录中的 information.php。

Source

【讨论】:

    猜你喜欢
    • 2013-09-19
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    • 2012-06-16
    • 2012-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多