I have a website made with wordpress and hosted with hostgator. Now I want to create another URL such as “www.website.com/something” and this URL should take me to the webpage that I hosted on my EC2 instance. How do I do that, can anyone please guide me ?
I haven’t tried anything because I have no idea how to do it.
You can try doing this through .htaccess for Proxying (Apache)
If your HostGator server uses Apache (which is common for many shared hosting services). then you can use the .htaccess
file to create a proxy.
This method will forward requests from your WordPress site to the EC2 instance.
Edit the .htaccess
File:
Connect to your HostGator server using FTP or the file manager in cPanel.
Locate the .htaccess
file in the root directory of your WordPress installation, most times, it is in the public_html
folder
Open the .htaccess
file and add the following lines
RewriteEngine On
RewriteRule ^something/(.*)$ http://<EC2-IP-or-Domain>/$1 [P,L]
Replace <EC2-IP-or-Domain>
with the IP address or domain name of your EC2 instance.
Save the .htaccess
file.
Kindly try this, and let’s see if it still works, there are other methods though but this appear to be faster and easier.