【问题标题】:Using .htaccess to get content from directory for sub-domain使用 .htaccess 从目录中获取子域的内容
【发布时间】:2015-12-10 03:42:14
【问题描述】:

我已经阅读了大量关于此的问题并尝试了一些解决方案,但我没有得到我想要的结果。

我目前正在使用:

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.nethttp://example.net/gamepanel/public 显示内容,同时在 URL 中显示子域。

cp.example.net/user 也应该显示来自example.net/gamepanel/public/user 的内容

非常感谢您对实现这一目标的帮助!

【问题讨论】:

    标签: apache .htaccess laravel url-rewriting


    【解决方案1】:

    事实证明,我对我需要做的事情有点偏离目标,而 .htaccess 并不是最好的方法。

    在我的 apache 文件中添加这个解决了它

    <VirtualHost *:80>
            ServerName cp.example.net
            DocumentRoot /var/www/gamepanel/public
            <Directory /var/www/gamepanel/public>
                Options -Indexes
            </Directory>
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-06
      • 2011-07-15
      • 2023-04-05
      • 2012-06-06
      • 2014-02-25
      相关资源
      最近更新 更多