2016-10-02 53 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]