我正在尝试完成一些事情:我example.com是域名和example.com/subpath,每当您降落在example.com/subpath中并单击节点时,它将是example.com/subpath/node。我需要在.htaccess中编写一个规则,以便当用户降落在子路上时,URL将变得像:subpath.example.com/node
有建议吗?我当时在想使用一个变量,但对此并不真正自信。
您需要使用重写规则。尝试这个
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
DirectoryIndex page/index.html //first page
RewriteRule ^node$
subpath/node.php [QSA,L]