Move an Megento site to new url

So I hade to move en megent site from to this is so that you can test and try new stuff on a site that is not you primary site.
Moving magneto was some hazzel it not as easy as other site is take som sql to make it work.




  1. First setup you webbserver  (This is only the basic)


<VirtualHost *:80>
 ServerAlias Indexes + Directory Root.
 DirectoryIndex index.html
 DocumentRoot /var/www/ Logfiles
 ErrorLog /var/log/apache2/error.log
 CustomLog /var/log/apache2/access.log combined




2. Setup you sql

CREATE database test_topunder_se;
REATE USER 'top_test'@'localhost' IDENTIFIED BY 'top_test_pass';
GRANT ALL PRIVILEGES ON test_topunder_se.* TO 'top_test'@'localhost';
flush privileges;


3. Setup the copy of megento

cp -r


Change the database setting in the new copy of the site


 <initStatements><![CDATA[SET NAMES utf8]]>


Now lets fill the database with some stuff. First we will dumpt the old and and make some change then reloadet inte the new database.

mysqldump -u root -p topunder > /topunder.sql    <--- dump the live database
sed -i 's/topunder\.se/test\.topunder\.se/g' /topunder.sql   <-- replace with ELSE SITE WILL NOT WORK
mysql -u root -p test_topunder_se < /topunder.sql    <--- insert the new data in the new database


Done Done !!