繁体   English   中英

使用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/; }

有关详细信息,请参见本文档本文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM