dpp10181 2015-12-31 20:26
浏览 135
已采纳

Joomla主页重定向与nginx

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;
}
}
  • 写回答

1条回答 默认 最新

  • doutong6814 2015-12-31 20:59
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。