我的朋友,我使用的是正確的虛擬域副htaccess文件請幫忙(我已閱讀htaccess文件的內容,但我太糊塗)虛擬子站點的htaccess
輸入=>http://www.example.com/
負載=>http://www.example.com/index.php
輸入=>http://sample.example.com/
負載=>http://www.example.com/directory/sample/index.php
htaccess的:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.lidlike.com
RewriteCond %{HTTP_HOST} ^([^.]+).lidlike.com
RewriteRule ^$ /index.php?name=%1 [L]
我有兩個要求,第一
Enter => http://www.example.com/
Load => http://www.example.com/
Enter => http://sample.example.com/
Load => http://www.example.com/directory/sample/
第二種情況:得到一個子域名PHP的
index.php
<?php
$SubName=$_GET['name'];
?>
我得到它,但我不明白
Options +FollowSymLinks -Multiviews
RewriteEngine on
RewriteBase/
#
# Canonicalize the hostname
RewriteCond www.%{HTTP_HOST} ^(www)\.(example\.com) [OR]
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.(example\.com) [OR]
RewriteCond %{HTTP_HOST} ^([^.]+)\.www\.(example\.com) [OR]
RewriteCond %{HTTP_HOST} ^([^.]+)\.(example\.com). [OR]
RewriteCond %{HTTP_HOST} ^([^.]+)\.(example\.com):[0-9]+
RewriteRule (.*) http://%1.%2/$1 [R=301,L]
#
# If subdomain is NOT www
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
# Extract (required) subdomain to %1
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$
# Rewrite if requested URL resolves to existing file or subdirectory in /subdomains/<subdomain>/ path
RewriteCond %{DOCUMENT_ROOT}/subdomains/%1/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/subdomains/%1/$1 -d
RewriteRule (.*) /subdomains/%1/$1 [L]
http://www.webmasterworld.com/apache/3638570.htm
你只需要指向每個子域和不同webroots。它現在在工作嗎?你準確的問題是什麼? – Tchoupi
現在我使用這段代碼,我完成了以下步驟。 1)* .example.com RewriteEngine on RewriteCond%{HTTP_HOST}!^ www.lidlike.com RewriteCond%{HTTP_HOST} ^([^。] +)。lidlike.com RewriteRule^$ /index.php? name =%1 [L] – Saeid
沒有人?她謝謝我,我可以幫助 – Saeid