Reputation: 23
I want to redirect all my media files to maxcdn origin poll, this might be duplicate question
but couldn't find the way i was looking for.
example: If visitor request something like : http://domain.com/monday/day1.mp3 it needs to redirect to http://xxx.netdna.com/monday/day1.mp3.
Question: --- No To This :/
Will nginx allow .htaccess to do this job?
Or
Do I need to setup server config? How
Here is my config, which is every simple.
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /var/www/domain/public_html;
index index.html index.php index.htm;
# Make site accessible from http://localhost/
server_name domain.com;
return 301 http://XXX.YYYY.netdna-cdn.com$request_uri;
The page isn't redirecting properly
Please Help!
Upvotes: 1
Views: 644
Reputation: 23
I have found solution for my problem after a huge dig search on google, but the answer was so simple, didn't realized till it turned on working perfectly for my problem... :)
All I need to add was, following code right after location /
Here is what i added and worked like charm.
try_files $uri $uri/ /index.php;
Upvotes: 0
Reputation: 14374
Will nginx allow .htaccess to do this job?
No. There is no .htaccess
analogue for nginx.
This will redirect all request to folder /podcast/
to xxx.netdna.com
.
location /podcast/ {
return 301 http://xxx.netdna.com$request_uri;
}
Upvotes: 2