Hi.
My site is currently working fine at the url ‘mysite.com’. I’d obviously like ''www.mysite.com to get re-directed to ‘mysite.com’ though.
I’ve tried the various suggestions in these threads and the documentation, and unfortunately none seem to work for me - I just get an error from my internet provider when I try to view the www version, and a time-out when I try to ping it. I would be extremely grateful if you could let me me exactly what I have to do to get this working.
A Record:
Hostname: @
IP Adress: my.ip.address
CNAME:
Hostname(mysite): www
Hostname: @ (also tried mysite.com)
and in my htaccess:
<IfModule mod_rewrite.c> RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC] RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] </IfModule>
Many 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!
@gokay.mustafa: To enable mod_rewrite, run the following commands as root: <br><pre>sudo a2enmod rewrite <br>sudo service apache2 restart</pre>
You have to enable mod_rewrite (a2enmod rewrite) and add RewriteEngine On before the RewriteCond’s.
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.