#RewriteEngine On #RewriteCond %{HTTP:X-Forwarded-Proto} !https #RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
RewriteEngine on RewriteCond %{HTTP_HOST} ^www.mrtownhome.net [NC] RewriteRule ^(.*)$ http://mrtownhome.net/$1 [L,R=301]
RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
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!
What is it that isn’t working?
It seems like your domain is pointing to different locations. www.mrtownhome.net to InMotion Hosting mrtownhome.net to CloudWays on DigitalOcean
And you’re running both Nginx and Apache - as far as I can tell, which adds extra configuration overhead, which might be more difficult to setup correctly.
How it should be setup really depends on what you’re trying to do :-).
In the example you’ve posted, RewriteEngine On exists three times. Keep it at the top of the file and remove the other two instances of that line.
That should leave us with:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.mrtownhome.net [NC]
RewriteRule ^(.*)$ http://mrtownhome.net/$1 [L,R=301]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUESTFILENAME} !-f
RewriteCond %{REQUESTFILENAME} !-d
RewriteRule . /index.php [L]
With that, is this particular instance behind a proxy? I’m asking due to the second line. If so, then you may very well need a bit of code in wp-config.php to handle this instead of .htaccess.
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.