Crazy Serb
Crazy Serb

Reputation: 76320

.htaccess rule to rewrite calls from subdomain to amazonaws

I am looking to rewrite all calls to

subdomain.domain.com/video.mp4

to rewrite to

https://s3.amazonaws.com/whatever/video.mp4

How would I do that?

And this is for embedded calls in video players/scripts...

Upvotes: 1

Views: 135

Answers (2)

Wige
Wige

Reputation: 3918

Assuming you have a dedicated folder for the subdomain, you would just need the following rule:

RedirectMatch 301 /(.*) https://s3.amazonaws.com/whatever/$1

Upvotes: 0

anubhava
anubhava

Reputation: 785126

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com$ [NC]
RewriteRule ^(.+)$ https://s3.amazonaws.com/whatever/$1 [R=301,L]

Upvotes: 1

Related Questions