Вопрос по 301 редиректу и OpenCart

K1
На сайте с 23.05.2012
Offline
66
3674

Друзья, настроил на сайте использование https протокола, поставил редиректы, вроде бы все нормально, но вот заметил ерунду, что адрес вида http://lacomfy.com/bedroom-furniture редиректится на страницу https://lacomfy.com/index.php?_route_=bedroom-furniture, а должен на https://lacomfy.com/bedroom-furniture. В чем может быть проблема? Почему появляется лишний кусок в урл и как это поправить, чтоб был нормальный редирект с http на https.

это .htaccess

Options All -ExecCGI -Indexes -Includes +FollowSymLinks


Options +SymLinksIfOwnerMatch
ErrorDocument 404 /catalog/view/template/usa/error/no_found.tpl
# Prevent Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
Order deny,allow
Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On

# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^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]



#This setting force logo url to it's home page
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule ^index\.php$ https://lacomfy.com/? [R=301,L,NE,NC]

#This setting force http to https version
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://lacomfy.com/$1 [R=301,L,NE]





##
### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none
#RewriteCond %{QUERY_STRING} ^route=common/home$
#RewriteCond %{REQUEST_METHOD} !^POST$
#RewriteRule ^index\.php$ https://%{HTTP_HOST}? [R=301,L]
#RewriteCond %{HTTP_HOST} !^lacomfy.com$ [NC]
#RewriteRule ^(.*)$ https://lacomfy.com/$1 [L,R=301]

#RewriteCond %{SERVER_PORT} !^443$
#RewriteRule ^(.*)$ https://lacomfy.com/$1 [R=301,L]

RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://lacomfy.com%{REQUEST_URI} [L,R=301]




<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include mime ^text\.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image\.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
#<ifModule mod_deflate.c>
# AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
#</ifModule>
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"

ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"

ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 604800 seconds"
ExpiresByType application/javascript "access plus 604800 seconds"
ExpiresByType application/x-javascript "access plus 604800 seconds"

ExpiresByType text/html "access plus 43200 seconds"

ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>



BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

Ищу решение не для конкретной категории, а сразу какой-то универсальный способ, ведь редиректить отдельно каждую категорию - это много, ведь их (вместе с подкатегориями) более 80.

SK
На сайте с 10.05.2008
Offline
108
#1

вроде редиректы и не нужны, в настройках включить ssl

и config.php изменить http на https

хотя не уверен, давно делал...

HostiQ - Хостинг, который радует (http://goo.gl/jTd7hf)
K5
На сайте с 13.07.2014
Offline
49
#2

Если ваш редирект действительно работает корректно, переместите его выше, под строку RewriteBase /

Это должно решить проблему

K1
На сайте с 23.05.2012
Offline
66
#3
SHoKKiNG:
вроде редиректы и не нужны, в настройках включить ssl
и config.php изменить http на https
хотя не уверен, давно делал...

Не так все просто :)

K1
На сайте с 23.05.2012
Offline
66
#4
karpo518:
Если ваш редирект действительно работает корректно, переместите его выше, под строку RewriteBase /
Это должно решить проблему

Он то работает корректно, ко конкретно для этого случая нет никакого правила редиректа. Вот и прошу совета, как правильно прописать его.

Пример:
1. Заданная страница - http://lacomfy.com/kids-furniture
2. Переадресовывается на https://lacomfy.com/index.php?_route_=kids-furniture где получаем лишний "хвост" в виде - "index.php?_route_="
3. А нужно что переадресация шла на https://lacomfy.com/kids-furniture


---------- Добавлено 26.09.2015 в 09:03 ----------

UP

Уже разобрался. Поправил правила переадресации, перенеся их вверх. На другом форуме подсказали. Как мне объяснили, правила переадресации должны быть выше правил движка, и тогда все будет хорошо. А так у меня все было написано нормально.

WebAlt
На сайте с 02.12.2007
Offline
263
#5

Если nginx, то:

server {

server_name example.org www.example.org;
...................................
...................................
...................................
...................................
...................................
listen XX.XX.XX.XX:80;
return 301 https://$host$request_uri;
}

P. S. Вот это:

Options All -ExecCGI -Indexes -Includes +FollowSymLinks

Options +SymLinksIfOwnerMatch
#######Лишнее, уже прописано выше#######
Options -Indexes
###################################

Можно одной строчкой:

Options -ExecCGI -Includes +FollowSymLinks +SymLinksIfOwnerMatch -Indexes

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