重定向但保持域相同

时间:2014-12-15 02:51:25

标签: apache .htaccess redirect httpd.conf

我有一个自己的云服务器,我想设置第二个短域,以保持共享链接的简短。

我们可以说我们是longdomain.com和short.com Heres是我的httpd行

<VirtualHost *:80>
    ServerAdmin email@adderss.com
    DocumentRoot /var/www/dir/public_html
    ServerName short.com
    ServerAlias www.short.com
    RewriteEngine on
    RewriteRule ^/([A-Za-z0-9]{4,12})$ https://www.long.domain.com/public.php?service=shorty_relay&id=$1 [QSA,L]
    ErrorLog /var/www/dir/error.log
</VirtualHost>

使用当前行,short.com会重定向到我需要的位置,但我希望此重定向位于后台,并将短域保留在用户的浏览器中。 我怎么能这样做?

更新

在我的短域虚拟主机中,我可以使用短域访问我自己的云。 例如:short.com/index.php/apps/files /

长域消失了。我想我现在向前迈进了一步。

ProxyPass / https://www.long.domain.com
ProxyPassReverse / https://www.long.domain.com

下一步是使用正则表达式,这样我只能加载短的id链接。

如何将上面的重写正则表达式与proxypass相结合。 我已经尝试过ProxyPassMatch,但我还没弄明白如何正确使用它 有什么想法吗?

1 个答案:

答案 0 :(得分:0)

如果您无法通过short.com对同一内容进行寻址,则short.com可以通过加载mod_proxy,mod_proxy_http以及将重写标志从R更改为P来代理长域。

相关问题