久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Symfony 動態(tài)子域

Symfony dynamic subdomains(Symfony 動態(tài)子域)
本文介紹了Symfony 動態(tài)子域的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時(shí)送ChatGPT賬號..

我正在嘗試將子域與 symfony 中的客戶 ID 匹配.

I'm trying to match subdomains to a customer id in symfony.

即我有 customer1.example.com 和 customer2.example.com

i.e. i have customer1.example.com and customer2.example.com

域存儲在表中.

當(dāng)用戶訪問 customer1.example.com 時(shí),我想獲取子域,在數(shù)據(jù)庫中查找域名,匹配后,它將為該客戶部署應(yīng)用程序配置,然后將 customer_Id 存儲在一個(gè)全局屬性,所以我確切地知道我在整個(gè)應(yīng)用程序中與哪個(gè)客戶打交道.虛擬主機(jī)將具有相關(guān)的通配符服務(wù)器名稱.

When a user goes to customer1.example.com, I would like to get the subdomain, look up the domain name in the database, once matched, it will then deploy the app config for that customer and then store the customer_Id in a global attribute so i know exactly which customer I'm dealing with througout the whole application. The virtual host will have the relevant wildcard servername.

您是否設(shè)法實(shí)現(xiàn)了這一目標(biāo),如果是,如何實(shí)現(xiàn)?如果沒有,任何想法都會有很大幫助!

Have you managed to achieve this, and if so, how? If not, any ideas would be a great help!

我正在考慮使用過濾器來做到這一點(diǎn).

I'm thinking about using a filter to do it.

:-)

推薦答案

還需要將您的域設(shè)置為通配符域,否則您將需要為每個(gè)客戶端手動創(chuàng)建每個(gè)子域.

also going to be needing yo set your domain as a wildcard domain, if not you going to need to create manually each subdomain per client.

另一個(gè)不太依賴于 symphony 的解決方案是使用 .htaccess

another solution that is not so symphony dependent is using a .htaccess

    <IfModule mod_rewrite.c>
   Options +FollowSymLinks
   Options +Indexes
   RewriteEngine On
   RewriteBase /
   RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]
   RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC]
   RewriteRule (.*) $1?sub=%2&page=$1&domain=%{HTTP_HOST} [QSA,L]
<IfModule>

該代碼基本上會將子域、域和請求的頁面發(fā)送到請求的頁面.然后在 php 中你可以檢查它是否等于你的客戶端用戶名.并允許您同時(shí)為您的客戶使用托管域名.

that code basically will send to the requested page the subdomain, the domain and the page requested. then in php you can check if it is equal to your client username. and allow you also to use parked domains for your clients at the same time.

希望能幫到你.

這篇關(guān)于Symfony 動態(tài)子域的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產(chǎn)品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產(chǎn)品的總訂單數(shù))
Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和電話字段驗(yàn)證問題中添加自定義注冊字段)
Add a select field that will change price in Woocommerce simple products(在 Woocommerce 簡單產(chǎn)品中添加一個(gè)將更改價(jià)格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產(chǎn)品列表)
Customizing checkout quot;Place Orderquot; button output html(自定義結(jié)帳“下訂單按鈕輸出html)
主站蜘蛛池模板: 午夜视频在线观看视频 | 亚洲日本乱码在线观看 | 国产精品激情在线 | 超碰高清| 日日操操| 中文字幕亚洲精品 | 99热.com| 91热在线 | 91久久久久久久久 | 日韩三级电影在线看 | 精品免费国产视频 | 亚洲综合一区二区三区 | 日韩免费在线观看视频 | 国产精品视频一区二区三区 | 一区二区三区久久久 | av在线亚洲天堂 | 成年人在线视频 | 欧美video| 亚洲成a| 欧洲成人 | 91色视频在线观看 | 台湾佬伊人 | 日本高清视频在线播放 | 精品粉嫩超白一线天av | 在线观看中文字幕一区二区 | 密室大逃脱第六季大神版在线观看 | 精品国产成人 | 在线亚洲免费 | 精品麻豆剧传媒av国产九九九 | 一区二区三区免费 | 国产在线拍偷自揄拍视频 | 国产在线h | 欧美伊人影院 | 午夜影院操 | 国产成人免费在线 | 亚洲福利网站 | 在线视频第一页 | 成人 在线 | 国产ts人妖另类 | 国产日韩视频 | 日本中文字幕一区 |