万维当云伯乐 CDN华纳云
PHP技术2024-03-301,028 阅读

Nginx强制域名跳转到主域名代码

本文摘要if ($host != 'gfw.upward-club.com') { rewrite ^/(.*)$ https://gfw.upward-club.com/?url=$host$1 permanent; } public function index(Request $request) { $param = $
丽萨主机
AD:
【广告招商】文章正文文字广告位开放合作
 if ($host != 'gfw.upward-club.com') {
    
        rewrite ^/(.*)$ https://gfw.upward-club.com/?url=$host$1 permanent;
    }
public function index(Request $request)
    {
        $param = $request->param();
        $url = $request->param('url');
        //如果没有传递URL链接
        if(!$url){
            $data = [
              'old_url' => 'https://gfw.upward-club.com/' ,
                'new_url'=> 'https://gfw.upward-club.com/',
            ];
            View::assign('data',$data);
        }
        $result = Db::name('idcmaster_gfwfree')->where('old_url',$url)->find();
        if ($result){
            View::assign('data',$result);
        }else{
            $data = [
                'old_url' => 'https://gfw.upward-club.com/' ,
                'new_url'=> 'https://gfw.upward-club.com/',
            ];
            View::assign('data',$data);
        }
        return view();
    }
 
广告招商文章内容详情页下 · 优质席位开放中合作咨询