Apache 使用.htaccess从子域的目录中获取内容
我已经读了很多关于这方面的问题,并尝试了一些解决方案,但我没有得到我想要的结果 我目前正在使用:Apache 使用.htaccess从子域的目录中获取内容,apache,.htaccess,laravel,url-rewriting,Apache,.htaccess,Laravel,Url Rewriting,我已经读了很多关于这方面的问题,并尝试了一些解决方案,但我没有得到我想要的结果 我目前正在使用: RewriteEngine on RewriteCond %{HTTP_HOST} ^cp\.example\.net RewriteRule ^(.*)$ http://example.net/gamepanel/public/$1 [L,NC,QSA] 这并没有达到预期的效果。当我导航到cp.example.net时,我被重定向到http://example.net/gamepanel/pub
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cp\.example\.net
RewriteRule ^(.*)$ http://example.net/gamepanel/public/$1 [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>
ServerName cp.example.net
DocumentRoot/var/www/gamepanel/public
选项-索引