Question

I want to redirect a file download from

mysite.com/setup.exe to supercoolcdn/setup.exe

I had earlier written some redirect rule myself,but it had resulted in loops and brought the website down eventually.

Can someone suggest me a proper way to do it.

Était-ce utile?

La solution

You can use redirect rule like this in your root .htaccess:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com$ [NC]
RewriteCond ^setup\.exe$ http://cdn.com/downloads%{REQUEST_URI} [L,R=301,NC]
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top