D
D
Dmitry Kamyannoy2016-10-04 11:10:57
PHP
Dmitry Kamyannoy, 2016-10-04 11:10:57

How to create a redirect to the mobile version of the site, including how to set it up for SEO?

Good morning dear gurus . The question in the title is not complete because there is not enough space. Questions - 2 .
1. If we create a site with a separate domain, for example, like habr https://habrahabr.ru/ and https://m.habrahabr.ru/ , the question arises: How to create a redirect so that it remains possible to walk between domains? ( there is a thought in my head about cookies that are destroyed after the current session or even disabled - but to be honest I'm not sure if this is right, too clumsy way )
2. How to deal with SEO? (After all, in the case of Drupal, it can be both multi-site and simply configured configs or the use of modules like Domain access . But everyone has a problem with DUPLICATION OF CONTENT . )
Thank you very much in advance ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artyom, 2016-10-04
@redfieldone

Use .htaccess for your site.

RewriteEngine On
RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^ http://m.habrahabr.ru%{REQUEST_URI} [R,L]

Or shove it in front of the site header
If the screen size is less than 800px
<script type="text/javascript">
  <!--
  if (screen.width <= 800) {
    window.location = "http://m.habrahabr.ru";
  }
  //-->
</script>

Here you can read on Google, there are also options and I will say a lot about SEO https://developers.google.com/webmasters/mobile-si...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question