Hello,
Years ago, I set up .htaccess rules for www/non-www versions of my website. As I transfer it to DigitalOcean, I want to make sure I don’t incur any SEO penalties for a change in this configuration.
Could someone please tell me how to apply the following rules to my DigitalOcean App? Note that I’m not using Apache (because it’s just an App in the DigitalOcean console), so I can’t simply copy the .htaccess file.
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^!www\.example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/example($|/.*$)
RewriteRule ^.* http://www.example.com%1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
I’m not an .htaccess expert, so please let me know if there are errors I should account for. My primary goal is to make my migration invisible to search engines in this regard.
Thanks!
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!
This comment has been deleted
Hi @JustAnotherUser,
As far as I know, at this point in time, It is not possible to add URL rewrites to the App platform. But you can post this idea on the below link:
Additionally, you can try using one of the Droplets provided by DigitalOcean, they are like any other server/droplet which you can customize and install whatever you want on them.
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.