nginx redirect URL to subdomain

خرید بک لینک

I want to direct somefile.mydomainname.co TO www.mydomainname.co/somefile.html

Below is my nginx config, please help me.

server {
  server_name  MYDOMAINNAME.co;
  retu 301 $scheme://www.MYDOMAINNAME.co$request_uri;
}

server {
  listen   80;
  server_name  www.MYDOMAINNAME.co staging.MYDOMAINNAME.co;

  access_log /var/log/nginx/MYDOMAINNAME.co_access.log;
  error_log /var/log/nginx/MYDOMAINNAME.co_error.log;

  root   /var/www/html/MYDOMAINNAME.co;
  index index.html;

  # Caching
  location ~* .(html|htm)$ {
    add_header Cache-Control "public, max-age=120, s-maxage=300";
  }

  # Assets
  location ~* .(js|css|png|jpg|jpeg|gif)$ {
    add_header Cache-Control "public, max-age=3600, s-maxage=300";
    access_log /var/log/nginx/MYDOMAINNAME.co_assets_access.log;
    error_log /var/log/nginx/MYDOMAINNAME.co_assets_error.log;
  }

  # Security & Misc
  location = /robots.txt  { log_not_found off; access_log off; }
  location = /favicon.ico { log_not_found off; access_log off; }
  location = /sitemap.xml { log_not_found off; access_log off; }

  location ~ /. { deny all; }
  location ~ ~$ { deny all; }

}

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 310 تاريخ: چهارشنبه 13 مرداد 1395 ساعت: 15:05

صفحه بندی