[英].htaccess subdomain to subdirectory without changing URL in joomla
[英]Subdomain points to subdirectory dynamically through htaccess without changing URL
我想通過htaccess動態將子域指向子目錄,而不更改下面顯示的url和目錄列表。
|-- Test (Root Directory) <-- test.com redirects to this folder.
|-- index.php
|
|-- subdomain (Directory)
|
|---- abc (Directory) <-- abc.test.com redirects to this folder.
|------ index.php
|
|---- pqr (Directory) <-- pqr.test.com redirects to this folder.
|------ index.php
|
|---- xyz (Directory) <-- xyz.test.com redirects to this folder.
|------ index.php
我已將以下重寫規則應用於點子域。
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.test.com
RewriteRule (.*) http://test.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^test\.com $
RewriteCond %{REQUEST_URI} !^/subdomain/
RewriteRule (.*) /subdomain/$1
RewriteCond %{HTTP_HOST} ^(^.*)\.test.com
RewriteCond %{REQUEST_URI} !^/subdomain/
RewriteRule (.*) /subdomain/$1
我在htaccess重寫方面不是很好。
我一直在關注這個子域
但是我沒有成功。 非常感謝您的建議。
謝謝。
希望這會有所幫助
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.test.com
RewriteRule (.*) http://test.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^\.]+)\.test\.com$ [NC]
RewriteRule ^(.*)$ http://test.com/subdomain/%1/$1 [L,NC,QSA]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.