0

I am with Joomla multisites an trying to make a redirection of the first page of the site:

Some thing like:

subdomain.mysite.io/  ->  subdomain.mysite.io/yoga

I tried to use that solution: How to redirect single url in nginx?

location / {
   rewrite ^/.* http://$subdomain.mysite.io/yoga permanent;
}

But I get conflict with the configuration file... this is my nginx file for the subdomain...

Could someone help me with that issue? I am using friendly rewrite rules!

server {

listen 80;
server_name subdomain.mystie.io www.subdomain.mysite.io;
server_name_in_redirect off;

root /home/joomla/mysite;
index index.php index.html index.htm;


# deny running scripts inside writable directories
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
        return 403;
        error_page 403 /403_error.html;
}

# Support Clean (aka Search Engine Friendly) URLs
location / {
    try_files $uri $uri/ /index.php?$args;

}

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
     root /home/workspaces/php/joomla/portal;
}


# caching of files 
location ~* \.(ico|pdf|flv)$ {
        expires 1y;
}

location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt|woff)$ {
        expires 14d;
}



location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}
}
Community
  • 1
  • 1
Diogo Wernik
  • 586
  • 8
  • 24

1 Answers1

1

To pick out a single URI, use the location = variant. To make the redirect permanent, use a return 301. Try:

location = / { return 301 $scheme://$host/yoga/; }

See this document and this document for details.

Richard Smith
  • 45,711
  • 6
  • 82
  • 81