Wordpress shows on IP and Domain Name after droplet install


I setup a wordpress blog using the 1-click install method, everything works great however my blog shows on both my domain & my IP which isn’t good for SEO (duplicate content). Do I need to edit my apache settings in order to redirect the IP to the domain? (if so… how!)

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

like @kely says it isn’t duplicate content however it does affect your SEO score once people join your website by IP (wich is most likely not going to happen since its alot more difficult). However you can have the google crawlers to change this IP to the domain name with a 301 redirect and as well have people redirected properly. For this you need to edit your apache VHOST / .htaccess . Make sure the 000-default.conf has AllowOverride All set for the wordpress directory, if you didn’t change this then it should be set on default. Now you want to create a .htaccess file inside the directory of wordpress ( default /var/www/html ) with the following:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^12\.34\.56\.789$
RewriteRule ^(.*)$$1 [L,R=301]

You need to replace the IP and domain to your own setup, once done make sure rewrite module is enabled:

a2enmod rewrite

then restart apache and the rewrite should work:

service apache2 restart

Hope you will figure it out with this, if you still have any questions don’t hesistate to ask them.