Showing posts with label wordpress change post url format. Show all posts
Showing posts with label wordpress change post url format. Show all posts

Solved: How to remove the AWS EC2 instance name from the URL?

After installing the website using AWS image you would have noticed that the URL still have reference of the EC2.
It can be in post URLs like
http://ec2-65-231-192-68.compute-1.amazonaws.com/your-post-name
How to get rid of that?
The easiest way to do it is by going to your wordpress dashboard.
In the dashboard go to Settings>General.
In the General Settings page you will see two parameters, WordPress Address (URL) and Site Address (URL).  Change them to your website name e.g. http://yourwebsite.com .
Finally save it. Your post URLs should now look like
http://yourwebsite.com/your-post-name
In Bitnami WordPress Image you will find that WordPress Address (URL) and Site Address (URL) will be greyed out and it won’t allow to modify them. In that case you will have to modify wp-config.php file.
For bitnami image the file location is /opt/bitnami/apps/wordpress/htdocs/wp-config.php. Keep a copy of old file and modify the current file
cp -p /opt/bitnami/apps/wordpress/htdocs/wp-config.php /opt/bitnami/apps/wordpress/htdocs/wp-config.php.oldsudo vi /opt/bitnami/apps/wordpress/htdocs/wp-config.php
Modify two lines which has entries for WP_HOME and WP_SITEURL . They  should now look like.
define('WP_HOME','http://yourwebsite.com');define('WP_SITEURL','http://yourwebsite.com');
If your website is having SSL certificate and you want all your posts and pages to have https. Than the above entries should look like.

define('WP_HOME','https://yourwebsite.com');define('WP_SITEURL','https://yourwebsite.com');
Finally save the file.
When you refresh the page it should now show your desired URL.
If the URL is still not showing correctly and you are sure that you have modified the file correctly than restart apache.
sudo /opt/bitnami/ctlscript.sh restart apache
This should get you done!