Hi. I have the droplet with wordress.
wordpress-ubuntu-s-1vcpu-1gb-amd-sfo3-01 Apache, Ubuntu 20
I followed this instruction https://certbot.eff.org/instructions
Now it’s working. https://mydomain.com/
- ok
But http://mydomain.com/
doesn’t work =(
The redirect goes here https://root/
:
error DNS_PROBE_FINISHED_NXDOMAIN
The .htaccess
in /var/www/html
:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Help me please
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
SOLVED.
find the two files: 000-default.conf 000-default-le-ssl.conf
in the folders: /etc/apache2/sites-enabled/ /etc/apache2/sites-available/
Replace YOURDOMAIN to your domain =)
Remove the lines with the wrong URL that you see in the browser. Like this
RewriteCond %{SERVER_NAME} =www.root [OR]
000-default-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName YOURDOMAIN
ServerAlias www.YOURDOMAIN
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerAlias crunchdubai.com
SSLCertificateFile /etc/letsencrypt/live/crunchdubai.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/crunchdubai.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
000-default.conf
UseCanonicalName On
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName YOURDOMAIN
ServerAlias www.YOURDOMAIN
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.crunchdubai.com [OR]
RewriteCond %{SERVER_NAME} =crunchdubai.com [OR]
RewriteCond %{SERVER_NAME} =www.root [OR] // DELETE THIS LINE
RewriteCond %{SERVER_NAME} =root [OR] // DELETE THIS LINE
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
restart Apache2 by command line or reset the server by “Power cycle”
Clear your browser cache
Enjoy
BIG THANX KFSys & Bobby Iliev
Hi there,
Your .htaccess
file looks good. The problem is most likely coming from the Apache Virtual Host for your website.
You can find the Apache virtual host in the following directory:
/etc/apache2/sites-enabled
In there there will be a file for your HTTP and HTTPS versions of your website. You need to find the one for the HTTP version of your website and update the redirect in there so that it does not go to https://root/
but to https://yourdomain.com
.
Feel free to share the content of the file here and I can advise you which lines you need to change!
Best,
Bobby
Hey @smallaquacrab,
The .htaccess file you’ve shown is perfectly fine. The issue is coming from your Apache virtual host and that is only for the HTTP part. Check your /etc/apache2/sites-available for the said vhost and if you need some help you can post it.
Most probably there is a redirect there which needs to be removed.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.