我想创建虚拟子域,例如:
user1.domain.com/anythging >> domain.com/users/user1/anything
无重定向
我在 htaccess 中使用这个 cdoe:
RewriteEngine on
DirectorySlash off
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com.*$ [NC]
RewriteRule ^(.*)$ http://domain.com/users/%1/$1 [P,L,NC,QSA]
但是当我使用: DirectorySlash off 我可以重写: user1.domain.com/anythging/ >> domain.com/users/user1/anything
以斜线 (/) 结尾(anything/),但这
user1.domain.com/anythging >> error 403: Forbidden
You don't have permission to access /users/user1/anythging on this server.
在第二种情况下,当我使用:
DirectorySlash ON
这个:
user1.domain.com/anythging >> redirects to >> domain.com/users/user1/anythging
但我想重写链接而不是重定向它!
知道问题出在哪里吗?