Доброе время суток. Есть проблема. Сразу скажу, что перечитал и это форум и кучу других, но не работает ни одно решение. Нужно получить редирет 301 на главную с index.html и index.php. Ни один из вариантов, которые указаны в конфиге апача - не работают (отделены друг от друга пустой строкой)
Options +FollowSymlinks
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Require all denied
</FilesMatch>
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
#301 редирект www
RewriteCond %{HTTP_HOST} ^www.nicoa.ru
RewriteRule ^(.*)$ http://nicoa.ru/$1 [R=301,L]
#301 редирект php html
#RewriteRule ^(.*)index\.(php|html|htm)$ $1 [R=301,L]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
#RewriteRule ^index\.html$ https://nicoa.ru/ [R=301,L]
#RewriteCond %{HTTP_HOST} ^nicoa.ru
#RewriteRule ^(.*)$ https://nicoa.ru/index.html [R=301,L]
#Redirect permanent /index.html http://nicoa.ru
#Redirect 301 /index.html https://nicoa.ru?
#RewriteCond %{QUERY_STRING} ^_route_=about.html
#RewriteRule ^(.*)$ http://mysite.ru/o-nas [R=301,L]
# 301 редирект для главной страницы БЕЗ index.(php|html|htm)
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html|htm)\ HTTP/
#RewriteRule ^(.*)index\.(php|html|htm)$ $1 [R=301,L]
В чем может быть дело? url.php пытался править, но это идейно неверно по моему, да и результат тот же
Специальных SEO инструментов нет
Конфиг Nginx
server {
server_name nicoa.ru www.nicoa.ru;
add_header Strict-Transport-Security "max-age=31536000;";
ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
charset off;
index index.php;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/nicoa.ru/*.conf;
ssi on;
set $root_path /var/www/nicoaru/data/www/nicoa.ru;
root $root_path;
include /etc/nginx/vhosts-resources/nicoaru/*.conf;
location / {
try_files $uri @opencart;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @fallback;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
try_files $uri $uri/ @fallback;
expires 10d;
}
}
location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}
location = /sitemap.xml {
rewrite ^(.*)$ /index.php?route=feed/google_sitemap break;
}
location ~* (\.(tpl|ini))$ {
deny all;
}
location @fallback {
proxy_pass http://127.0.0.1:8080;
proxy_redirect http://127.0.0.1:8080 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}
rewrite ^/sitemap.xml$ /index.php?route=extension/feed/google_sitemap last;
access_log /var/www/httpd-logs/nicoa.ru.access.log;
error_log /var/www/httpd-logs/nicoa.ru.error.log notice;
gzip on;
gzip_comp_level 5;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
listen ю...:443 ssl http2;
}
Лично меня напрягает дублирование строк в конфиге Nginx
location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}
И в апаче
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Это может приводить к таким эффектам? Строка адреса с множественным редиректом содержит именно _route_