【问题标题】:.htaccess to redirect subdirectory path name and mask with custom name.htaccess 以自定义名称重定向子目录路径名和掩码
【发布时间】:2014-12-01 21:27:12
【问题描述】:

我有一个名为 CMS {example.com/cms} 的子目录。我需要将其重定向到 example.com/blog 并使用名称 blog 进行屏蔽。在执行此操作时,example.com/cms/page1 还应使用 example.com/blog/page1 进行重定向和屏蔽。我需要执行此操作的 .htaccess 代码。我已经尝试了所有可用的代码,没有任何效果。

我尝试的代码是

重写规则 ^blog/(.+)$ /cms/$1 [L,NC]

【问题讨论】:

  • 你能展示你尝试过的示例代码吗?

标签: .htaccess url url-redirection url-masking


【解决方案1】:

您可以在您的DOCUMENT_ROOT/.htaccess 文件中使用此代码:

RewriteEngine On
RewriteBase /

RewriteRule ^cms(/.*)?$ blog$1 [L,NC]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-09-30
    • 1970-01-01
    • 1970-01-01
    • 2015-08-21
    • 1970-01-01
    • 2021-11-14
    • 2010-11-17
    • 2011-05-10
    相关资源
    最近更新 更多