nfxera
Last Updated: February 25, 2016
·
393
· emincan

Redirect directory to a subdomain with htaccess

I have a real address of http://cdn.example.com/videos/video.mp4. But when I try to embed it as video tag in https://www.example.com/video-page, the browsers have mixed content warning. I needed to use a subdomain as a directory because of SSL. So I used this code in htaccess:

RewriteCond %{REQUEST_URI} ^/cdn
RewriteRule ^cdn/(.*)$ http://cdn.example.com/$1 [R=301,L,P]