使用htaccess

时间:2015-11-05 13:36:04

标签: .htaccess url-rewriting subdomain

我正在用这个htaccess重写我的网址:

RewriteEngine on
# Options +FollowSymlinks
RewriteBase /

# REDIRECT MAIN DOMAIN
RewriteCond %{HTTP_HOST} ^(www.)?domain.nl$
# /subfolder/
RewriteCond %{REQUEST_URI} !^/www.domain.nl/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
# /subfolder/
RewriteRule ^(.*)$ /www.domain.nl/$1
# site
# subfolder/
RewriteCond %{HTTP_HOST} ^(www.)?domain.nl$ 
RewriteRule ^(/)?$ www.domain.nl/ [L]



# SUBDOMAINS to /sub.domain.nl/
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.nl$ [NC]
RewriteCond %{HTTP_HOST} !^www\.domain\.nl$ [NC]
RewriteRule ^(.*)$ http://domain.nl/%1.domain.nl/$1 [P,L]

这会将子域带到子文件夹。所以x.domain.nl转到domain.nl/x.domain.nl。 但是,这也显示为[SCRIPT_URI] => http://domain.nl/x.domain.nl/ 是否有可能所有$ _SERVER变量在所有变量上只显示x.domain.nl而不是长版本?

谢谢!

0 个答案:

没有答案