Jump to content

Change domain name of shop directly in Database V 1.7


brunomorais
 Share

Recommended Posts

Hi,

I'm trying to change the domain of a Prestashop V 1.7 directly in the database from mystore.com to mystore.net for instance.

I went to database in table ps_configuration fields PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL and change the domain to mystore.net.

The problem is when I go to mystore.net I'm always redirected to the old domain mystore.com .

I'm missing something here.

Anyone can help?

Thanks.

 

regards,

Bruno Morasi

  • Like 1

Share this post


Link to post
Share on other sites

I believe those fields in the ps_configuration table are the older ways of doing it.  Once multi-store feature was created, the domain information is now stored in the ps_shop_url table.

 

Once changed, you also need to ensure the .htaccess or nginx rules are updated to reflect the new domain.

 

An easier approach is to just log into the back office and change the domain name in the SEO & URL page, and let Prestashop take care of the rest.

  • Like 2

Share this post


Link to post
Share on other sites

  • 4 weeks later...

I changed domain in alll three tables that you mentioned but it still redirects to old domain. please advise.

 

Thanks

Once changed, you also need to ensure the .htaccess or nginx rules are updated to reflect the new domain.

  • Like 1

Share this post


Link to post
Share on other sites

I am facing the same exact problem.

But i did not find the ps_shop domain on the prestashop 1.7 database, is that removed? I am using the version 1.7.1.2

 

Also, what do i need to modify on the .htaccess file in order to prevent the redirection from the remote server to localhost?

 

Thank you for your time. Here is my .htaccess code which is apparently wrong and redirects to localhost, even if the website and database are on remote server.

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>

RewriteEngine on


#Domain: localhost
RewriteRule . - [E=REWRITEBASE:/prestashop/]
RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/font-woff .woff
AddType application/font-woff2 .woff2
<IfModule mod_headers.c>
    <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

#If rewrite mod isn't enabled
ErrorDocument 404 /prestashop/index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
Edited by DavidTech (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

  • 1 year later...
  • 3 weeks later...
  • 2 weeks later...
  • 1 month later...

I forgot to buy SSL on the new Domain so i had to disable SSL in the Database temporary:

UPDATE `ps_configuration` SET `value` = 0 WHERE `name` = 'PS_SSL_ENABLED';
UPDATE `ps_configuration` SET `value` = 0 WHERE `name` = 'PS_SSL_ENABLED_EVERYWHERE';
Edited by heyho (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

  • 1 year later...

hello i did 

1.7.6.1

 

change your prefix "ps_" if you installed with another.. 

 

mysql -u prestausr -p;
pass--
show databases;
use prestashop-name-here;
UPDATE `ps_configuration` SET `value` = 'staging.example.com' WHERE `ps_configuration`.`id_configuration` = 229;
UPDATE `ps_configuration` SET `value` = 'staging.example.com' WHERE `ps_configuration`.`id_configuration` = 230;
UPDATE `kh_shop_url` SET `domain` = 'staging.example.com', `domain_ssl` = 'staging.example.com' WHERE `kh_shop_url`.`id_shop_url` = 1;
vi /var/www/html/example.com/.htaccess 

 

/var/www/html/example.com/.htaccess
change all old domain name to new domain name
old.example.com
staging.example.com 


then update apache with correct virtualhost 

 

Edited by prestol (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

  • 1 year later...

Hello Prestashopers

On the DB in table: `ps_shop_url`, change the 'domain' value for your new URL, also in 'domain_ssl'

then, when you can log to your back office go to

On 8/31/2018 at 5:43 AM, Harkanwal said:

Shop Parameters> Traffic & SEO

and save again the same information in the part "Set shop URL" and working

  • Like 1

Share this post


Link to post
Share on other sites

  • 4 months later...

Hello Prestashopers!

Also have the same problem here. 

I need to change my domain to access my dashboard, just one question: If i change my domain on my DB table will the sales data from the old domain be erased? Or it will just create a new DB without any kind of info? 

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More