【问题标题】:Need a Htaccess Redirect需要一个 Htaccess 重定向
【发布时间】:2023-03-06 02:06:02
【问题描述】:

我的网站出现了一些错误,需要为我的网址进行 301 重定向,如下所示:

https://firstnamelastname.example.com/the-wall 转到 https://example.com/new-wall/firstnamelastname,其中 firstnamelastname 是任何名称。

【问题讨论】:

    标签: .htaccess url redirect


    【解决方案1】:

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

    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^(?!www\.)([^.]+)\.(example\.com)$ [NC]
    RewriteRule ^the-wall/?$ http://%2/new-wall/%1 [L,NC,R=301]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-11
      • 1970-01-01
      • 1970-01-01
      • 2012-08-18
      • 1970-01-01
      • 2012-11-04
      相关资源
      最近更新 更多