Já mostramos-lhe como redirecionar temporariamente seus visitantes para uma página de manutenção no WordPress usando plugins populares. Esse método é muito bom, mas alguns desenvolvedores preferem por a mão na massa, preferindo a rota não-plugin. Pois bem, neste artigo, vamos mostrar-lhe como redirecionar visitantes para uma página de manutenção temporária no WordPress sem plugin.
Este post é parte de uma série
- Como redirecionar visitantes para uma página de manutenção temporária no WordPress com o Plugin Maintenance Mode
- 6 tipos de Páginas de Manutenção – que trabalham para você
Método .htaccess
Um método é via .htaccess, que permite definir um IP para acessar o site. Este é um snippet para um projeto de um único desenvolvedor.
# MAINTENANCE-PAGE REDIRECT RewriteEngine on RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000 RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC] RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC] RewriteRule .* /maintenance.html [R=302,L]
Basicamente, tudo que você precisa fazer é mudar o Remote_Address para o seu endereço IP. Em seguida, você precisa criar uma página chamada maintenance.html. Esta deve ser armazenada no seu diretório raiz. O código basicamente permite que você veja todo o site, e todo resto veja a página maintenance.html.
Se você quiser permitir múltiplos endereços IP, então use essa técnica:
order deny,allow deny from all allow from 123.456.789 allow from 123.456.789 ErrorDocument 403 /custom-message.html order allow,deny allow from all
Basta adicionar quantos endereços IP você deseja permitir. Todo resto verá a página “custom-message.html“. Você pode adicionar o que quiser no arquivo personalizado.
Honestamente, optar por um plugin de modo de manutenção no WordPress é muito mais fácil.
Pergunta para os usuários: Porque você acha que a rota não-plugin é melhor?
Nota: Brad Williams apontou que há outro método de fazer isso, que é, na verdade, built-in no WordPress. Confira a série de posts de Matt “Sivel” Martz (1), (2) e (3).
8 respostas
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
At the beginning, I was still puzzled. Since I read your article, I have been very impressed. It has provided a lot of innovative ideas for my thesis related to gate.io. Thank u. But I still have some doubts, can you help me? Thanks.
Wow, fantastic weblog structure! How lengthy have you ever been running a blog for?
you make running a blog look easy. The whole
look of your site is great, let alone the content material!
You can see similar here sklep internetowy
I’ll right away take hold of your rss as I can not in finding your
e-mail subscription hyperlink or e-newsletter service.
Do you’ve any? Please permit me understand in order that I could subscribe.
Thanks. I saw similar here: Sklep online
Quality content is the crucial to attract the viewers to
go to see the web page, that’s what this website is providing.
I saw similar here: Sklep internetowy
It’s very interesting! If you need help, look here: ARA Agency
Hi there! Do you know if they make any plugins to assist with SEO?
I’m trying to get my website to rank for some targeted keywords but I’m
not seeing very good success. If you know of any please share.
Kudos! You can read similar blog here: AA List
Hi! Do you know if they make any plugins
to assist with Search Engine Optimization? I’m trying to get
my website to rank for some targeted keywords but I’m not seeing
very good gains. If you know of any please share. Cheers! You can read similar blog here:
Auto Approve List