Joomla主页重定向与nginx

时间:2015-12-31 20:26:06

标签: php .htaccess redirect nginx joomla

我和Joomla multisites一起尝试重定向网站的第一页:

有些事情:

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

我尝试使用该解决方案:How to redirect single url in nginx?

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

1 个答案:

答案 0 :(得分:1)

要选择单个URI,请使用setlocal EnableDelayedExpansion if exist username.txt ( REM Read from text file: set /p "user="<username.txt ) else ( REM Read from keyboard: set /p "user=Enter your username: " REM Write to text file: echo !user!>username.txt ) 变体。要使重定向成为永久性,请使用location =。尝试:

return 301

有关详细信息,请参阅this documentthis document