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

Symfony 動態子域

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

問題描述

限時送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

域存儲在表中.

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

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.

您是否設法實現了這一目標,如果是,如何實現?如果沒有,任何想法都會有很大幫助!

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

我正在考慮使用過濾器來做到這一點.

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

:-)

推薦答案

還需要將您的域設置為通配符域,否則您將需要為每個客戶端手動創建每個子域.

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.

另一個不太依賴于 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>

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

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.

希望能幫到你.

這篇關于Symfony 動態子域的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產品的總訂單數)
Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和電話字段驗證問題中添加自定義注冊字段)
Add a select field that will change price in Woocommerce simple products(在 Woocommerce 簡單產品中添加一個將更改價格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產品列表)
Customizing checkout quot;Place Orderquot; button output html(自定義結帳“下訂單按鈕輸出html)
主站蜘蛛池模板: 欧美午夜在线观看 | 欧美精品在线视频 | 538精品视频 | 亚洲成人免费在线观看 | 国产做受视频 | 人人爽人人干 | 在线观看欧美日韩视频 | 国产精品一区在线播放 | 精品亚洲一区二区三区 | 欧美福利一区 | 五月天婷婷综合网 | 懂色av一区二区三区 | 成人在线视频播放 | 毛片一级片 | 在线免费观看日韩av | 亚洲69视频| 在线中文字幕 | 亚洲国产精品va在线看黑人 | 黄色小视频免费观看 | 黄色一级片网站 | www99热 | 亚洲一级特黄 | 国产精品呻吟 | 四虎在线观看视频 | 中文字幕一区二区三区在线观看 | 欧美日韩国产中文 | 亚洲精品色图 | 人人干人人爽 | 日本不卡在线视频 | 日本三级在线视频 | 久久久久黄色 | 亚洲天堂免费视频 | 国产精品欧美精品 | 手机av片 | 成人国产精品免费观看 | 日韩欧美黄色片 | 天天爽天天| 五月天婷婷在线观看 | 亚洲高清在线观看 | 国产福利视频 | 免费一级黄色录像 |