字preSS和子域htaccess的 [英] Wordpress and subdomains htaccess
问题描述
我目前已安装在我的服务器的基本路径字preSS。字preSS使用的htaccess对用户友好的URL。另外我有通配符子域的必要,因为我有用户想访问一个特定的系统。
当用户访问www.domain.com,或者只是domain.com,就应该服字preSS。如果他们正在请求giraffesinafrica.domain.com,通过dir应设置/系统/(在基路径的文件夹)
在文件夹/系统/我还有一个控制的.htaccess重定向到该网址。
我希望有人能带领我的方式:)
在此先感谢!
RewriteEngine叙述上
#3,内部重定向到店
的RewriteCond%{REQUEST_URI}!-f
的RewriteCond%{HTTP_HOST} ^([^。] +)\。域\ .COM $
重写规则^(。*)$子域/ [L,NC,QSA]
#BEGIN字preSS
的RewriteBase /
重写规则^指数\ .PHP $ - [L]
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则./index.php [L]
#结束字preSS
您谈谈/系统,而你的code使用/子域,所以我将使用后者。
RewriteEngine叙述上
#改写子域单独的文件夹
重写规则^子域/ - [L]
的RewriteCond%{HTTP_HOST}!^ WWW \。域\ .COM $
的RewriteCond%{HTTP_HOST} ^([^。] +)\。域\ .COM $
重写规则^(。*)$子域/ $ 1 [L]
#如果你想重写sub.domain.com/test到/子域/子/测试
#RewriteRule ^(。*)$子域/ 1%/ $ 1 [L]
#力WWW
的RewriteCond%{HTTP_HOST} ^域\ .COM $
重写规则^(。*)$ http://www.domain.com/$1 [R]
#BEGIN字preSS
的RewriteBase /
重写规则^指数\ .PHP $ - [L]
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则./index.php [L]
#结束字preSS
I currently have Wordpress installed in the base path of my server. Wordpress uses htaccess for user-friendly URL's. In addition I have the need of wildcarded subdomains, as I have users wanting to access a specific system.
When the user visits www.domain.com, or just domain.com, they should be served Wordpress. If they are requesting giraffesinafrica.domain.com, the dir should be set to /system/ (a folder in base path)
In the folder /system/ i have another .htaccess controlling the URLS redirected into that..
I hope someone can lead me on the way :)
Thanks in advance!
RewriteEngine On
# 3. internal redirect to the shop
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$
RewriteRule ^(.*)$ subdomain/ [L,NC,QSA]
# BEGIN WordPress
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./index.php [L]
# END WordPress
You talk about /system, while your code uses /subdomain, so I will use the latter.
RewriteEngine On
# rewrite subdomains to separate folder
RewriteRule ^subdomain/ - [L]
RewriteCond %{HTTP_HOST} !^www\.domain\.com$
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$
RewriteRule ^(.*)$ subdomain/$1 [L]
# or if you want to rewrite sub.domain.com/test to /subdomain/sub/test
#RewriteRule ^(.*)$ subdomain/%1/$1 [L]
# force www
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R]
# BEGIN WordPress
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./index.php [L]
# END WordPress
这篇关于字preSS和子域htaccess的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!