By adamkyala
Hey guys,
My google-fu hasn’t turned anything up, so I thought I’d ask here.
My current site is adamyala.com But if I go to www.adamyala.com I get a not found error.
I already have the www A @ record in my DNS for this domain.
I have multiple sites on my droplet, so each one has it’s own config file in:
/etc/apache2/sites-available
Below are the contents of my config file (I removed my email address even though it’s on my site): ` <VirtualHost *:80> ServerAdmin xxxxxxxxx@gmail.com ServerName adamyala.com ServerAlias www.adamyala.com
DocumentRoot /var/www/adamyala
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/adamyala>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost> `
What else do I have to add for this to work?
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 is done using .htaccess usually, it’s called a 301 redirect. <br>You either go with non-www to www or the other way around. <br>So using those terms you can find it on google or other search engines. <br>Sticking with just one is also good for SEO purposes and can increase your Google Page Rank. <br> <br>Here’s generic .htaccess code for www to non-www <br> <br>#Redirect www to non-www <br>RewriteEngine On <br>RewriteBase / <br>RewriteCond %{HTTP_HOST} ^www.(.)$ [NC] <br>RewriteRule ^(.)$ http://%1/$1 [R=301,L]
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.