Answer the question
In order to leave comments, you need to log in
Digitalocean: how to redirect to www?
I created a wordpess blog on digitalocean, I realized that it doesn’t go to the page if it says www.myname.ru. Comes only without www. I added www to the url in the wordpress admin panel and now I can't access the site at all.
How to fix it? And how to make the site work on the link with and without www?
Server: apache
OS: ubuntu.
Please explain step by step. I don't understand this topic. Thanks in advance!
Answer the question
In order to leave comments, you need to log in
You need to find the config of your virtual host in /etc/apache2/ (usually in /etc/apache2/site-availiable/) and add an alias in it:
ServerName site.ru
ServerAlias site.ru *.site.ru
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC]
RewriteRule ^(.*)$ http://site.ru/$1 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question