Jump to content
brunomorais

Change domain name of shop directly in Database V 1.7

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

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.

Share this post


Link to post
Share on other sites

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

 

Thanks

Share this post


Link to post
Share on other sites

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.

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)

Share this post


Link to post
Share on other sites

DavidTech - where should we now follow your issues? You have it open on two different threads.

Share this post


Link to post
Share on other sites

In Admin page go to CONFIGURE> Shop Parameters> Traffic & SEO

SET SHOP URL 

and you have new URL for your store.

Share this post


Link to post
Share on other sites

prestashop also has a table named "xx_shop_url" (where xx is your database pre) in there you should also change the url.

  • Thanks 1

Share this post


Link to post
Share on other sites
On 13/07/2017 at 11:03 PM, brunomorais said:

Hi,

1- change table "ps-configuration" -> PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL   value

2- Change table "ps-shop-url"

3- Rewrite the .htaccess

 

 

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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