Jump to content

One installation not accessible from distinct server names


Recommended Posts

Trying to be a good developer, I installed the shiny new PrestaShop to localhost. Works fine so far, plusminus a few installation glitches (bug reported).


Next step would be to refine the theme a bit for our needs, so I tried to connect from the phone on the same network segment. Not http://localhost/, but http://servername/


This doesn't work. Instead of opening the shop, the phone's browser gets redirected to literally http://localhost, which doesn't run the shop, of course (it's the phone's localhost, then). The correct way would be to stay at http://servername/ and handle requests there.


Another reason I try to get this running is, I plan to develop and test locally before changing the public site. Anything else would be gambling. Synchronisation is no problem, but how would I deal with this if the very same data here doesn't work there?


I grep'd for PS_SHOP_DOMAIN in the code, where this hardcoded name is apparently stored, but it doesn't look like this is actually used in a meaningful place (the few functions which do use it don't get called from anywhere).


Any idea on how to get rid of this hardcoded servername in PrestaShop?

Link to comment
Share on other sites

Within a few hours I managed to create a patch which would avoid the redirect and allow to connect independently via any of the server's names. But it also out that this clamping to a single host name is written pretty deeply into the code, so it's liekly I missed a spot or two.


Looks like I have to find a way to change the host name inside the database during the synchronisation process. At least one can connect to the admin panel with the "wrong" host name given.

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