Jump to content

Products 404 if I do friendly URL together with my domain name


Recommended Posts

I have a Bitname AMI install on Ubuntu on Amazon elastic cloud. I'm running cloudflare for DNS.   PrestaShop version 1.6.1.4  


I had two issues I wanted to resolve before going live with my site and loading a bunch of products.  envyshave.com

Frist issue is that the back office displayed envyshave.com just fine, but the front office used my Amazon cloud DNS ec2-50-17-178-69.compute-1.amazonaws.com  as my web address. 

Second issue was that it wasn't loading search friendly trailing portion of the URL.  So I created a .htaccess file and gave it 666 permision. then I turned on Friendly URL rewriting in the backoffice. This seemed to work great. I was now getting a URL querry that was search friendly, Now to change the Domain name to match my store in the front office. I changed it from 
ec2-50-17-178-69.compute-1.amazonaws.com to envyshave.com under  Shop Domain and SSL domain in "set up show URL"  Now the domain shows envyshave.com in the front office. But if I click on a product I get a 404.    If I turn friendly url off, it works, or if I change the shop and SSL domain back to ec2-50-17-178-69.compute-1.amazonaws.com then it works, I just can't have them both on. I tried deleting the .htaccess file and recreating it, but that did not work. 

I tried changing my hostname on the server by changing the host file as well as the hostname file, then using the command  hostname envyshave.com.  I then restarted hostname service and ultimately restarted the server. 

It still does not work. I don't see any problems with cloudflare. Hopefully I'm missing something obvious or i"m making a rookie mistake. 

I tried adding a products but they have the same problem as the old product. 

I also tried changing the disable apache's muliview option to YES
And tried changing the disable Apache's mod_security Module to YES. 


post-881413-0-12464000-1470349469_thumb.png

May or may not be related, but when the server is freshly restarted it resolves to http://ec2-50-17-178-69.compute-1.amazonaws.com/ instead of envyshave.com for quite a few minutes. 

There is a note about enabling mod_rewrite but I have not had any luck on figuring it out with bitnami ubuntu, I'm not even sure it's a problem since friendly URL works without my domain. 

Link to comment
Share on other sites

  • 3 months later...

OK so I noticed that this only fixes it until you reboot.  The answer to this problem is found at 
https://docs.bitnami.com/google/apps/prestashop/

In summary there is a file that rewrites both the htaccess.conf as well as prestashop configuration for "shop domain" and "ssl domain" in preferences - SEO and URLs in prestashop.

"Updating The IP Address Or Hostname

PrestaShop requires updating the IP address/domain name if the machine IP address/domain name changes. The bnconfig tool also has an option which updates the IP address, called –machine_hostname (use –help to check if that option is available for your application). Note that this tool changes the URL to http://NEW_DOMAIN/prestashop.

sudo /opt/bitnami/apps/prestashop/bnconfig --machine_hostname NEW_DOMAIN

If you have configured your machine to use a static domain name or IP address, you should rename or remove the /opt/bitnami/apps/prestashop/bnconfig file.

sudo mv /opt/bitnami/apps/prestashop/bnconfig /opt/bitnami/apps/prestashop/bnconfig.disabled

NOTE: Be sure that your domain is propagated. Otherwise, this will not work. You can verify the new DNS record by using the Global DNS Propagation Checker and entering your domain name into the search field."

 

You can also change your hostname by modifying it in your hosts file. Enter the new hostname using your preferred editor."

So if you need to fix the problem you can use the "helpful tool"  or disable and fix it manually.  I renamed my bnconfig because I'm on a static IP via Amazon cloud.  On a changing IP address the tool might be helpful. 

Also you may want to allow remote access to you phpmyadmin while you have SSH access. 

Edited by nanial (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...