![](/img/trans.png)
[英]redirect all requests to another domain using .htaccess but keeping the original url
[英]htaccess - redirect requests to default page on one domain to a file while dont redirect requests from another domain
我有一個即時消息發布網站的情況。 我最初啟動供貢獻者訪問的區域:sell.domain.com,而我繼續開發www.domain.com。 兩個域將共享相同的基礎文件。
我希望sell.domain.com的請求不顯示基本站點,而是重定向到sell.domain.com/file.php,這將是參與者的登錄頁面(隱藏“前端”網站仍在開發中)。
我希望對www.domain.com的請求能夠正常顯示而無需重定向(DNS當前指向www.domain.com的其他位置,因此我可以使用主機文件訪問此域進行開發)。
重定向時,我不希望每個頁面請求(例如sell.domain.com/otherpage.php)都重定向。 只有根? (index.php)
這可以實現嗎?
嘗試重定向規則
// .htaccess文件
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ file.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
</IfModule>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.