【问题标题】:PHP redirect with inserting constant suffix inside the url [closed]PHP重定向,在url中插入常量后缀[关闭]
【发布时间】:2019-08-19 15:48:26
【问题描述】:

我有一个具有以下 url-type 的页面:

https://domain.name/brandname

我需要将其 303 重定向到

https://domain.name/constant-category-name/brand_brandname

url的一部分

常量类别名称/品牌_

应该在https://domain.name/之后的url中插入

filetype= .twig , Opencart 3

【问题讨论】:

    标签: php url redirect opencart


    【解决方案1】:

    类似这样的:

    <?php
    
    $url = "https://domain.name/brandname";
    preg_match('/\/(?:.(?!\/))+$/', $url,$matches);
    $brandname = ltrim ($matches[0], "/");
    $newurl =  "https://domain.name/constant-category-name/brand_".$brandname;
    header('Location: '.$newurl);
    

    【讨论】:

    猜你喜欢
    • 2015-10-11
    • 1970-01-01
    • 1970-01-01
    • 2017-06-01
    • 2013-05-18
    • 1970-01-01
    • 2015-11-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多