If you have ever tried to set-up a localhost install of the Magento e-Commerce system for development purposes using WAMP, XAMPP you may have already run into the problem of URL / Domain validation halting the install process due to using localhost as the domain. This tutorial will explain how to successfully install Magento on you PC hosted localhost server.
The image above shows the error you will receive when trying to install Magento on a PC running WAMP, XAMPP etc. The error happens because Magento tries to validate the domain name under which you install the Magento system, when you use http://localhost as your domain Magento halts the install process completely. This can be a really annoying fact that stops a lot of people installing Magento on their home PC to evaluate it before committing to the system for there e-Commerce project. The short tutorial below will show you how to bypass this particular install error and successfully install Magento on your localhost test machine.
Firstly you will need to edit a Magento file to acheive this technique, it’s pretty easy to do so anyone should be able to follow this tutorial but if your not confident editing a file get a friend who is to do it for you. To edit any files we recommend that you use PSpad which is a text editor specifically built for editing php, javascript files etc.
1) Open you Magento folder and go to the directory /js/prototype/
2) You will see a file titled validation.js, open this file in your text editor.
3) Look for the code between lines 505 to 507, it should look like the code snippet below.
['validate-url', 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)', function (v) {
return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
}],
4) now you want to comment out those three lines of code by typing // in front of each of them, the code snippet below gives an exact example of what you should end up with after the edits. These edits disable only those three lines of code which check for a valid domain name upon Magento installation.
//['validate-url', 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)', function (v) {
//return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
//}],
5) Install Magneto on your localhost, after install has completed successfully revert the validation.js file to it’s original code by removing the instances of // you added.
You should now have a fully functional install of Magento on your WAMP, XAMPP install on your home PC or business development server. If you have any questions about this technique please leave a comment.
March 2, 2011 at 5:26 am
I followed the steps, mentioned, but at last I am redirected to the same page while clicking on “continue” button
April 1, 2011 at 2:04 am
thankx its working
July 11, 2011 at 7:32 am
how did you fix it? I’ve got the same problem.
March 7, 2011 at 4:43 am
I don´t understand why magento launch a software whit many problemas to instal. its disgusting…
March 9, 2011 at 7:04 pm
I finally took the advise of one guy and disabled Java in my browser. It worked like a charm. Hope this helps someone else.
March 10, 2011 at 8:54 am
hey guys here is the simple solution
for Windows XP with wammp / xammp any server
open run commend and type
c:\windows\system32\drivers\etc\hosts
open it with notepad and change localhost to http://www.localhost.com
after that type http://www.localhost.com to you address bar
visit ingenious-vision.net
July 14, 2011 at 8:24 am
Love this.
Works like a charm
March 25, 2011 at 5:37 pm
l follow this tuts, but a have problem after l button “continue” show report like this,,
“There has been an error processing your request
Exception printing is disabled by default for security reasons.”
can u help me..??
March 28, 2011 at 11:36 am
Hi Topan,
Try this thread out see if it helps
http://www.eukhost.com/forums/f15/exception-printing-disabled-default-security-reasons-error-log-record-numb-11362/
April 15, 2011 at 1:08 am
great explanation and thanks for share i was looking to solve this problem i’m this post will help every magento developer
April 21, 2011 at 2:39 am
Great Good job! saved me a lot of time trying to create a localhost.com. Thank you n keep it up.
June 29, 2011 at 6:17 pm
100% Funcionando, muchas gracias por compartir su conocimiento.
July 26, 2011 at 7:42 pm
Use 127.0.0.1 instead of localhost. Refresh/ reload the page before entering 127.0.0.1 and tick mark the “Skip Base URL Validation Before the Next Step” option. that would work.
July 27, 2011 at 8:21 pm
Great post, Dude………….
August 7, 2011 at 11:48 pm
Hi, the only that is needed is to add virtual host in httpd.conf file of appache and also add domain info in C:\Windows\system32\drivers\etc\hosts file if you are using windows, then all go well.
September 14, 2011 at 10:15 am
thanx a ton….
September 20, 2011 at 10:57 pm
A very useful post.
now its working..
thanx.
September 23, 2011 at 11:18 pm
thanx for this post
its very helpful for installing magento to local server for testing purpose
October 2, 2011 at 10:10 pm
Thanks for this tutorial. But for the ones for whom it did not work. Try disabling javascript in the browser. Refresh the same page and now enter the localhost address. Everything works smoothly now. Hope it helps some one.
October 2, 2011 at 10:11 pm
One more thing. Do enable javascript on next page after it worked fine.
December 6, 2011 at 11:32 pm
Thanks a lot mate.. You have save lots of time for me…you rockzzzzz.
March 15, 2012 at 8:49 am
Thanks for this post!!