Saturday, April 2, 2011

Prestashop Tips - Domain name and hostname is saved in DB

Most PrestaShop owners or potential owners do not realize a small change in PrestaShop 1.4. The domain name or the hostnbame now is saved in database ps_configuration table.

So if you are going move you store domain, please be caution of this changes.
In following cases, you will need to manually change the data saved in ps_configuration table.

1. If you setup your store locally, then move to real hosting site by backup and restore method.
2. If you are going to move your store domain from one to another in the same hosting server, but keep the database not changed.
3. if you are going to move your store to complete different server or hosting companay.


If you do not change domain name, when you access your new domain of your website, it will always be redirect to old domain website.


Pleaase following this to change your domain name

1. Use database admin tool like PhpMyAdmin (from your site control panel)
2. Locate table ps_configuration
3. Look for records with following name (by default they ID is 155/156)

* PS_SHOP_DOMAIN
* PS_SHOP_DOMAIN_SSL

4. Change the domain name to your new domain.
Please note: domain means domain name only, should not include the path.
for example, if your store URL is http://abcde.com/shop/, then only input "abcde.com"

the subfolder should be defined in file /config/setting.inc.php of you store.

14 comments:

Anonymous said...

Your post helped me solve an issue. Thanks

Anonymous said...

Awesome tip! Save my day. Thanks a lot

Anonymous said...

Great tip. Unfortunately I found it after solving my problem. I changed my domain and pointed it to the same server as before, but it kept redirecting to the old one. I found a solution without changing the setting in the db. You can still access the backoffice by going to yourNewDomain.com/yourBackofficeDirectory and change the setting in SEO and URLs in prefferences.

I use multiple domains for various countries. Ideal for me would be if I could load the site with a different default language and currency based on the domain. Now it keeps redirecting from .xx to .xy

Alvin said...

I am not sure if your domain are using sharing the same PrestaShop application of are separated applications. It seems that 1.4x support multiple domains, but I haven't test it myself.

You can write some code in the init.php for 1.3x or /classes/FrontController.php for 1.4x file to make this happens.

Fabio said...

Hi,

i'm italian, my english isn't good.

I want to put PS in my local PC. I had some problems, and now i have read this post, maybe i can solve my problem.

i have a webiste:
www.mywebsite.ext/shop

so in local i should have:
127.0.0.1/mywebsite.ext/shop

i put 127.0.0.1/mywebsite.ext on PS_SHOP_DOMAIN
and i have '/shop/' on settings.inc.php

i call 127.0.0.1/mywebsite.ext/shop but it look like the url of css and images are wrong. (and in effect, they are!).

note: to look "something", i have to put _ (nothing!) on PS_HOMEPAGE_PHP_SELF

suggestions?

Alvin said...

Hi fabio
in case of following URL, you sill need to set the domain as "127.0.0.1". It should not include "mywebsite.ext" part.

127.0.0.1/mywebsite.ext/shop

domain name
127.0.0.1

Hope you understand what I mean

Fabio said...

Hi Alvin, yes i do!
Thanks for anwer!

i put:

- domain name
127.0.0.1

- and
define('__PS_BASE_URI__', '/mywebsite.ext/shop');
on settings.inc.php

Now it's "almost" work (sorry my english)

On my homepage 127.0.0.1/mywebsite.ext/shop

i dont see some pictures and every link give me 404 error :(

pic: http://goo.gl/3QEGB

Anonymous said...

Hi,
Alvin

How to live prestashop v1.3.4.0. I have configured settings.inc.php according to my database in mysql server. I serched in PS_SHOP_DOMAIN & ssl but there is not found.When i browse my site there is 500 (Internal Server) Error coming. Pls. help me how i remove this error from my site & how can i live my site. u can mail me- myeazylife2011@gmail.com

Alvin said...

1. For 1.3x, the domain name is not saved in database.

2. The internal server error 500 could be many causes.

one tip I can provide is to insert following line the in PHP script of the page cause error.

die("Hello here is OK");

First insert this line on the top.
if the "Hello here is OK" message appear on your page, it means the error does not happen here.

move forward a few lines of above code, and run your page again, until you find the line that cause the server internal error.

this is just a way to find the location of line the error cause.

from there you can figure what is cause and fix it.

It's just a tip, not a solution.

Anonymous said...

tnx, i hope i get my site running yet ;-) (transfered local to server, import db, look at setting.inc.php, but getting an blank screen when trying to load server BO)

...
nope...
anyother suggestions?
(ikbenmarck@gmail(dot)com)

Alvin said...

I saw your post at PrestaShop forum and I also replied, I hope you have got your problem solved.

cheers

CyprusCarNews.com said...

nice advise thanks

Anonymous said...

Thanks for the info!! it help me a lot!

Anonymous said...

Thanks alot this has helped me alot. After searching the web for minutes.