Редирект Хаос Мтел

Сега ще ви покажа как неправилни редиректи може да ви навредят много.

Както знаете Мтел вече не съществува и имаме А1. Нека да видим какво се случва със редиректите на сайта им?

Започваме със https://mobiltel.bg

$ curl https://mobiltel.bg/ -L -I -k
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:02:33 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.mtel.bg/
Vary: Accept-Encoding

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:02:33 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/mtel-stava-A1/
Vary: Accept-Encoding

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 16 Aug 2018 12:02:33 GMT
Content-Type: text/html
Connection: close
Last-Modified: Tue, 07 Aug 2018 08:31:39 GMT
ETag: "181300-e8b2-572d43907d0c0"
Accept-Ranges: bytes
Content-Length: 59570
Vary: Accept-Encoding

И проблема лъсна – сайта на A1 може да се гледа и под HTTP. Продължаваме със http

$ curl http://mobiltel.bg/ -L -I -k
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:03:32 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.mtel.bg/
Vary: Accept-Encoding

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:03:32 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/mtel-stava-A1/
Vary: Accept-Encoding

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 16 Aug 2018 12:03:32 GMT
Content-Type: text/html
Connection: close
Last-Modified: Tue, 07 Aug 2018 08:31:39 GMT
ETag: "182509-e8b2-572d43907d0c0"
Accept-Ranges: bytes
Content-Length: 59570
Vary: Accept-Encoding

И добавяме и www със и без HTTPS
$ curl http://www.mobiltel.bg/ -L -I -k
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:04:49 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.mtel.bg/
Vary: Accept-Encoding

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:04:49 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/mtel-stava-A1/
Vary: Accept-Encoding

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 16 Aug 2018 12:04:50 GMT
Content-Type: text/html
Connection: close
Last-Modified: Tue, 07 Aug 2018 08:31:39 GMT
ETag: "181300-e8b2-572d43907d0c0"
Accept-Ranges: bytes
Content-Length: 59570
Vary: Accept-Encoding

$ curl https://www.mobiltel.bg/ -L -I -k
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:04:55 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.mtel.bg/
Vary: Accept-Encoding

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:04:55 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/mtel-stava-A1/
Vary: Accept-Encoding

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 16 Aug 2018 12:04:55 GMT
Content-Type: text/html
Connection: close
Last-Modified: Tue, 07 Aug 2018 08:31:39 GMT
ETag: "182509-e8b2-572d43907d0c0"
Accept-Ranges: bytes
Content-Length: 59570
Vary: Accept-Encoding

Интересното е, че редиректа работи само към основната страница. Ако се зададе вътрешна страница линка се предава към последващия редирект.

$ curl https://www.mobiltel.bg/robots.txt -L -I -k
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:09:00 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.mtel.bg/robots.txt
Vary: Accept-Encoding

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:09:00 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/robots.txt
Vary: Accept-Encoding

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 16 Aug 2018 12:09:00 GMT
Content-Type: text/plain
Connection: close
Last-Modified: Thu, 17 May 2018 12:29:47 GMT
ETag: "183f09-4b8-56c65fdaca4c0"
Accept-Ranges: bytes
Content-Length: 1208
Vary: Accept-Encoding

Продължаваме със един друг домейн mtel.net

$ curl http://www.mtel.net/ -L -I -k
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:11:17 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.mtel.bg/
Vary: Accept-Encoding

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:11:17 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/mtel-stava-A1/
Vary: Accept-Encoding

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 16 Aug 2018 12:11:17 GMT
Content-Type: text/html
Connection: close
Last-Modified: Tue, 07 Aug 2018 08:31:39 GMT
ETag: "182509-e8b2-572d43907d0c0"
Accept-Ranges: bytes
Content-Length: 59570
Vary: Accept-Encoding

$ curl http://mtel.net/ -L -I -k
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:11:46 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.mtel.bg/
Vary: Accept-Encoding

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:11:46 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/mtel-stava-A1/
Vary: Accept-Encoding

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 16 Aug 2018 12:11:46 GMT
Content-Type: text/html
Connection: close
Last-Modified: Tue, 07 Aug 2018 08:31:39 GMT
ETag: "182509-e8b2-572d43907d0c0"
Accept-Ranges: bytes
Content-Length: 59570
Vary: Accept-Encoding

Същия резултат е и под HTTPS със или без www отпред.

Следващия домейн е mtel.bg койо май издържа най-дълго:
$ curl http://www.mtel.bg/ -L -I -k
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:21:34 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/mtel-stava-A1/
Vary: Accept-Encoding

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 16 Aug 2018 12:21:34 GMT
Content-Type: text/html
Connection: close
Last-Modified: Tue, 07 Aug 2018 08:31:39 GMT
ETag: "182509-e8b2-572d43907d0c0"
Accept-Ranges: bytes
Content-Length: 59570
Vary: Accept-Encoding

$ curl http://mtel.bg/ -L -I -k
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:21:41 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/mtel-stava-A1/
Vary: Accept-Encoding

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 16 Aug 2018 12:21:41 GMT
Content-Type: text/html
Connection: close
Last-Modified: Tue, 07 Aug 2018 08:31:39 GMT
ETag: "246b22-e8b2-572d43907d0c0"
Accept-Ranges: bytes
Content-Length: 59570
Vary: Accept-Encoding

Същия резултат е и под HTTPS със или без WWW.

Доста по-интересно е тук:
http://www.a1.bg/sitemap.xml
където линковете са към:
http://www.mtel.bg/sitemap_www.xml
http://www.mtel.bg/sitemap_products.xml
и изглежда генерирането им е спряло някъде през Май 2018та.

Влизаме във сайтмапа със продуктите където също сочат към mtel.bg и си харесваме първия:
https://www.mtel.bg/ustroystva/laptopi/acer/travelmate-x349.3370
и отваряме сорса. Намираме още 2 линка към mtel.bg:
http://mtel.bg/public/file/id/ebd9dc98957b723ce7be035e56dfcfe9/acer-travelmate-x349-product.png
https://media.mtel.bg/newsite2015/images/mega-menu/myki.jpg

Втория домейн може да се зареди със или без HTTPS разбира се. По-фрапантното е, че същата снимка може да се намери и тук:
http://media.a1.bg/newsite2015/images/mega-menu/myki.jpg
https://media.a1.bg/newsite2015/images/mega-menu/myki.jpg

Разбира се този хаос има и една приятна новина – все пак логването минава задължително през HTTPS:
$ curl -I http://a1.bg/moyat-a1-upravlyavay-sam-svoite-uslugi -L
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:31:39 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/moyat-a1-upravlyavay-sam-svoite-uslugi
Vary: Accept-Encoding

HTTP/1.1 302 Found
Server: nginx
Date: Thu, 16 Aug 2018 12:31:39 GMT
Content-Type: text/html
Connection: close
Set-Cookie: PHPSESSID=i7hoh0m33jdqkf36rldg41vlo6; path=/; domain=www.a1.bg; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=dss9df9253jluc4jbejkpjtqa3; path=/; domain=www.a1.bg; HttpOnly
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:31:39 GMT; path=/; domain=.a1.bg
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:31:39 GMT; path=/; domain=.a1.bg
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:31:39 GMT; path=/; domain=.a1.bg
Location: https://www.a1.bg/moyat-a1-upravlyavay-sam-svoite-uslugi
Vary: Accept-Encoding

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 16 Aug 2018 12:31:41 GMT
Content-Type: text/html
Connection: close
Set-Cookie: PHPSESSID=kl0lfvrmpp4pa4182fm77mrfm3; path=/; domain=www.a1.bg; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=v3a01obe7oocra81c2hceir6e1; path=/; domain=www.a1.bg; HttpOnly
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:31:41 GMT; path=/; domain=.a1.bg
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:31:41 GMT; path=/; domain=.a1.bg
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:31:41 GMT; path=/; domain=.a1.bg
Vary: Accept-Encoding

$ curl -I http://www.a1.bg/moyat-a1-upravlyavay-sam-svoite-uslugi -L
HTTP/1.1 302 Found
Server: nginx
Date: Thu, 16 Aug 2018 12:32:04 GMT
Content-Type: text/html
Connection: close
Set-Cookie: PHPSESSID=q36aqoaea4udfln23p4p5mms00; path=/; domain=www.a1.bg; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=t8nns92n1i1qjme3b55dgnoq03; path=/; domain=www.a1.bg; HttpOnly
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:32:04 GMT; path=/; domain=.a1.bg
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:32:04 GMT; path=/; domain=.a1.bg
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:32:04 GMT; path=/; domain=.a1.bg
Location: https://www.a1.bg/moyat-a1-upravlyavay-sam-svoite-uslugi
Vary: Accept-Encoding

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 16 Aug 2018 12:32:05 GMT
Content-Type: text/html
Connection: close
Set-Cookie: PHPSESSID=bl1fub9vcmqlnjmug87nsam4a7; path=/; domain=www.a1.bg; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=di8qdhfdkd56rg68ca8757kta4; path=/; domain=www.a1.bg; HttpOnly
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:32:04 GMT; path=/; domain=.a1.bg
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:32:04 GMT; path=/; domain=.a1.bg
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:32:04 GMT; path=/; domain=.a1.bg
Vary: Accept-Encoding

Обаче защо със 302 редирект?

И последен тест със новия домейн А1:

$ curl -I http://a1.bg/test -L
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:37:21 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/test
Vary: Accept-Encoding

HTTP/1.1 404 Not Found
Server: nginx
Date: Thu, 16 Aug 2018 12:37:21 GMT
Content-Type: text/html
Connection: close
Set-Cookie: PHPSESSID=em2uptm6ja7735d74ons6srka1; path=/; domain=www.a1.bg; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=bjfopn6pgd82glq69cp9sumt97; path=/; domain=www.a1.bg; HttpOnly
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:37:21 GMT; path=/; domain=.a1.bg
Vary: Accept-Encoding

$ curl -I https://a1.bg/test -L
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 16 Aug 2018 12:36:41 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: close
Location: http://www.a1.bg/test
Vary: Accept-Encoding

HTTP/1.1 404 Not Found
Server: nginx
Date: Thu, 16 Aug 2018 12:36:41 GMT
Content-Type: text/html
Connection: close
Set-Cookie: PHPSESSID=rurlb92cva9hkr3tac8mf95l81; path=/; domain=www.a1.bg; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=u9190l2kanjvkbl1jajm2s3b33; path=/; domain=www.a1.bg; HttpOnly
Set-Cookie: device=desktop; expires=Sun, 13-Aug-2028 12:36:41 GMT; path=/; domain=.a1.bg
Vary: Accept-Encoding

Разбира се за да бъде хаоса пълен canonical на техните адреси сочи към HTTPS://WWW което допълнително обърква бота кой е основния домейн.

Накратко ако правите редиректи не правете като тях. Това е и основната причина сайта все още да се вижда така:
site:mtel.bg
site:mobiltel.bg
site:mtel.net
и новия A1 да е частично индексиран близо 3 месеца след пускането му.

Статията има допълнение което може да бъде прочетено ето тук.

Редирект Хаос Мтел

3 thoughts on “Редирект Хаос Мтел

Вашият коментар

Вашият имейл адрес няма да бъде публикуван. Задължителните полета са отбелязани с *