Jump to content

Why is prestashop redirecting to localhost?


Recommended Posts

I have been having a hell of a time figuring out SSL and I finally understand how to make an ssl connection to the default page for Apache2.  I have prestashop setup on a VM that I've had to revert snapshots on about 100 times now because something always breaks and I can't figure out how to fix it.

I'm hosting off my own hardware in my house because I just want to learn how to set these things up.  If I run a real ecommerce site I would use a host.  Since I'm hosting from home, my ISP blocks port 80, so I can't do anything through port 80, I have to go through 443.  I go to prestashop and it starts the install after entering the database info.  This is accessing through the url (https://t4tcookiecutters.com).  It got through 12% of the install when it had some sort of handshaking error with ssl and everything just stopped working.  The webserver broke, my loadbalancer didn't even show it was listening to port 443 anymore even after a reboot, so that was yet another snapshot restore.  So when it was restored, I just went straight to the VM instead of an external browser and just put "localhost" in the URL so it wouldn't go through SSL and have another handshake problem.  That installed fine, but there is an obvious config setting that was set and I can't find it anywhere.  Why is the website trying to redirect to https://localhost?  It has to be a config because my cell phone outside of any internal networks also is sent to a failed url of https://localhost.

The only reference to a solution I found says to delete your .htaccess file and go to the backoffice and set your "main" and your "base".  I wasn't able to find an .htaccess file at all, from what I understand it's a hidden file that is located in the root directory of the website.  I read further I could just make a blank .htaccess file with nano or VIM.  I created a blank .htaccess file.  I went to the SEO URL section on the back office as instructed and I have no idea what main or base is, what are they talking about?  I assumed main must be index so I set that to the main url and I couldn't find anything for base, so I just skipped that.  Needless to say it didn't work, everything still re-directs to localhost.  Where do I find the configuration that is telling the webserver to keep redirecting this?

Link to comment
Share on other sites

I installed Phpmyadmin because apparently I have to set my url in the database under this table:

ps_shop_url

I installed phpmyadmin on the same ubuntu linux vm.  phpmyadmin only shows two databases that I believe belong to it.  I don't see anywhere that you can connect to another database.  Is this a convoluted process where I have to export a database and import it into phpmyadmin to make changes then export it and import back into the vm?!

If I go to mysql and type SHOW DATABASES;  it will show the two databases that show up in phpmyadmin, but there are 3 that are also listed in mysql that don't show up in phpmyadmin, one of which is presta_shop

Do I have to do something special to see all the other databases?  I'm connected to the same SQL

Link to comment
Share on other sites

I was able to figure out the permissions to see the database, now I don't know what field to put the correct URL in and if I need to select anything in the drop down menues.  Do I put the domain in
domain and domain_ssl?  If so do I just replace localhost with the url and do I need to select anything in the drop down menues?

 

image.png.67d0497b800e66d3228293307e5a11b2.png

Link to comment
Share on other sites

Hi,
yes, just rename localhost to a domain name without http or https, for example mydomain.com.
After that, you need to recreate it in the SEO & Url settings in the administration. htaccess.
Turn off url rewriting and save, turn on url rewriting and save.
And as the last thing, you need to recompile the template and delete the cache (on ftp it is the folder ./var/cache/prod and ./var/cache/dev)

https://classydevs.com/move-prestashop-from-localhost-to-server/

Edited by 4you.software (see edit history)
Link to comment
Share on other sites

Thank you so much!  The URL is working now.  The database is working on prestashop's back end, I can add a listing and see the listings that were installed by default because I just had it install the demo listings.  When I access the website, I can see the site, but none of the images are showing for the products and if I try to click any listing or go to any category I always get a 404 error.  It happens on any link I click from the main page.  In back office, I can see the images and navigate through the listings.

I don't know if I recompiled the template correctly.  I went to back office, Advanced Parameters, performance.  Under smarty, I changed the drop down menu for Template creation to "Recompile template if the files have changed"  I changed it but it didn't make the links work on the site.  I changed it to "Force compilation" but that didn't seem to do anything either.  It still doesn't let me go anywhere from the front page

I was able to delete ./var/cache/prod but ./var/cache/dev did not exist but I don't know how to get there.  I could only get to ./var/cache/prod from the directory /var/www/html/prestashop directory.  If I attempt to cd or rm -r that directory from any other location it can't find it.   Do I have to be in a certain directory that is not the root of the website in order to delete ./var/chache/dev?

  • Like 1
Link to comment
Share on other sites

Thank you for the help 4you.software.  I wasn't able to get that version of prestashop working, but with your instructions I understood how to change the parameters on my working vm where my website was originally setup.  It saved me a ton of time because I don't have to re-list everything on a new prestashop, and the site is functioning.

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...