Answer the question
In order to leave comments, you need to log in
Next.js + React/Redux how to do it right?
due to seo of spa, I started moving the site to next.js.
I have always done spa according to this principle:
<BowserRouter>
<Provider store={store}>
<Switch>
<Route component={PostContainer} exact path='/post/:id' />
<Route component={PostListContainer} exact path='/' />
</Switch>
</Provider>
</BrowserRouter>
Answer the question
In order to leave comments, you need to log in
There is an official example at https://github.com/zeit/next.js/tree/canary/exampl...
In fact, in Provider we wrap the application in _app.js , which is a wrapper for component pages
Because this example looked like this before.
############################################################################
#### Выбор основного зеркала (с www или без www) ####
############################################################################
# 1. Удалить www
#RewriteCond %{ENV:HTTPS} on
#Если включен https
#RewriteRule .* - [E=SSL:s]
#То создаем переменную ssl с текстом s
#RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
# Проверяем, содержит ли домен www в начале URL.
#RewriteRule ^(.*)$ http%{ENV:SSL}://%1/$1 [R=301,L]
# Перенаправляем удаляем www
# 2. Добавить www
#RewriteCond %{ENV:HTTPS} on
#Если включен https
#RewriteRule .* - [E=SSL:s]
#То создаем переменную ssl с текстом s
#RewriteCond %{HTTP_HOST} !^www\.(.*) [NC]
# Если нет www в начале домена
#RewriteRule ^(.*)$ http%{ENV:SSL}://www.%{HTTP_HOST}/$1 [R=301,L]
#Подставляем www и https если он включен.
RewriteCond %{HTTPS} off
RewriteRule .* - [E=SSL:s]
RewriteCond %{REQUEST_URI} !^(.*)/robots\.txt$
RewriteRule ^(.*)$ http%{ENV:SSL}://www.site.ru/$1 [R=301,L]
sort of figured it out ... did it like this
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.site.ru/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^(.*)/robots\.txt$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
You can also try like this:
RewriteCond %{HTTP_HOST} ^www\.site\.(.*)$ [NC]
RewriteRule ^(.*)$ https://site.%1/$1 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question