301 redirect

A1
На сайте с 23.07.2012
Offline
29
326

Сервер у меня nginx+php-fpm

У меня сайт несколько сайтов.

Мне нужно сделать так чтобы site.ru/index.php редиректила 301 на главную а остальные страницы типо site.ru/category 301 site.ru/index.php/category

Как это сделать?

У меня сейчас файл с /etc/nginx/site-avilable/site.ru выглядит так

server {

server_name site.ru www.site.ru site.com www.site.com;

root /var/www/alex/site.ru;

index index.htm index.html index.php;

access_log /var/log/nginx/site.ru.access.log;

error_log /var/log/nginx/site.ru.error.log error;

location ~* \.php$ {

fastcgi_pass unix:/var/run/php5-fpm-site.ru.sock;

include fastcgi_params;

fastcgi_read_timeout 300;

}

location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {

access_log off;

log_not_found off;

expires 1d;

}

location / {

try_files $uri $uri/ @handler;

}

location /news/ {

try_files $uri $uri/ @newshandler;

}

location @handler {

rewrite / /index.php;

}

location @newshandler {

rewrite /news/ /news/index.php;

}

location ~ /\. {

deny all;

}

}

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий