2016-10-02 105 views
0

我买了一个简短的域名,所以我可以分享像重定向短HTTP URL主HTTPS域

http://xxx.xx/itemID 

我已经配置了简短的域名DNS短网址指向我的服务器,现在我编辑Apache站点的conf和IM不能肯定是正确的程序:

<VirtualHost *:80> 
    ServerName xxx.xx 
    ServerAlias www.xxx.xx 
    Redirect/https://longname.xx/ 
</VirtualHost> 

基本上我想这样的:

http://xxx.xx/itemID ==>https://longname.xx/itemID

我还需要做什么?如何编辑htaccess

+0

你'Redirect'规则应该在'VirtualHost'配置工作。确保您在上述更改后重新启动Apache。 – anubhava

回答

0

将此代码放在.htaccess

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^example.com [NC,OR] 
RewriteCond %{HTTP_HOST} ^www.example.com [NC] 
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]