使用nginx重定向Joomla主页


Joomla home page redirect with nginx

我与Joomla多站点合作,试图重定向网站的第一页:

比如:

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

我试着使用这个解决方案:如何在nginx中重定向单个url?

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

但我与配置文件发生冲突。。。这是我子域的nginx文件。。。

有人能帮我解决这个问题吗?我正在使用友好的重写规则!

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;
}
}

要选择单个URI,请使用location =变体。要使重定向永久化,请使用return 301。尝试:

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

有关详细信息,请参阅本文档和本文档。