使用 .htaccess 从子域的目录中获取内容
Using .htaccess to get content from directory for sub-domain
我已经阅读了大量关于此的问题并尝试了一些解决方案,但我就是没有得到我想要的结果。
我目前正在使用:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cp\.example\.net
RewriteRule ^(.*)$ http://example.net/gamepanel/public/ [L,NC,QSA]
这并没有按预期工作。当我导航到 cp.example.net
时,我被重定向到 http://example.net/gamepanel/public/
我想要的是 cp.example.net
在 http://example.net/gamepanel/public
显示内容,同时在 URL.
显示子域
另外 cp.example.net/user
应该显示来自 example.net/gamepanel/public/user
的内容
对于实现此目标的一些帮助将不胜感激!
事实证明我对我需要做的事情有点偏离目标,而 .htaccess 并不是最好的方法。
在我的 apache 文件中添加这个解决了它
<VirtualHost *:80>
ServerName cp.example.net
DocumentRoot /var/www/gamepanel/public
<Directory /var/www/gamepanel/public>
Options -Indexes
</Directory>
</VirtualHost>
我已经阅读了大量关于此的问题并尝试了一些解决方案,但我就是没有得到我想要的结果。
我目前正在使用:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cp\.example\.net
RewriteRule ^(.*)$ http://example.net/gamepanel/public/ [L,NC,QSA]
这并没有按预期工作。当我导航到 cp.example.net
时,我被重定向到 http://example.net/gamepanel/public/
我想要的是 cp.example.net
在 http://example.net/gamepanel/public
显示内容,同时在 URL.
另外 cp.example.net/user
应该显示来自 example.net/gamepanel/public/user
对于实现此目标的一些帮助将不胜感激!
事实证明我对我需要做的事情有点偏离目标,而 .htaccess 并不是最好的方法。
在我的 apache 文件中添加这个解决了它
<VirtualHost *:80>
ServerName cp.example.net
DocumentRoot /var/www/gamepanel/public
<Directory /var/www/gamepanel/public>
Options -Indexes
</Directory>
</VirtualHost>