【问题标题】:how to redirect folder and its subfolders to subdomain如何将文件夹及其子文件夹重定向到子域
【发布时间】:2019-02-07 12:31:07
【问题描述】:

我有一个 wordpress 博客,我已将“上传”文件夹更改为子域。 我以前的地址是这样的。 https://guilaneman.ir/wp-content/uploads /.../.../ 我的新网址:

https://images.guilaneman.ir/1/

我使用了这段代码:但它不起作用:

重写引擎开启 RewriteBase / RewriteRule ^/uploads/(.*)$ https://images.guilaneman.ir/1/$1 [R=301,L]

请注意,我在子文件夹中有另一个 wordpress 博客,我将此代码放在我想要重定向的 wp-content 文件夹中。
如何将 guilaneman.ir/wp-content/uploads/ 重定向到 images.guilaneman.ir/1/

【问题讨论】:

  • @RaviSachaniya 非常感谢。我读了这篇文章,但我的问题是使用 htaccess 重定向。
  • @RaviSachaniya 我成功更改了我的网址,但我想将以前的路径重定向到新的路径

标签: .htaccess redirect


【解决方案1】:

重写左侧的错误匹配路径(/uploads/* wp-content/uploads/*)

RewriteEngine on
RewriteBase /
RewriteRule ^wp-content\/uploads\/(.*)$ https://images.guilaneman.ir/1/$1 [R=301,L]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-27
    • 2016-05-08
    • 1970-01-01
    相关资源
    最近更新 更多