Blog

How To Install Magento On Localhost Without URL Validation Error

How To Install Magento On Localhost Without URL Validation Error

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.

23 Responses

  1. I followed the steps, mentioned, but at last I am redirected to the same page while clicking on “continue” button

  2. I don´t understand why magento launch a software whit many problemas to instal. its disgusting…

  3. I finally took the advise of one guy and disabled Java in my browser. It worked like a charm. Hope this helps someone else.

  4. 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

  5. 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..??

  6. great explanation and thanks for share i was looking to solve this problem i’m this post will help every magento developer

  7. Great Good job! saved me a lot of time trying to create a localhost.com. Thank you n keep it up.

  8. 100% Funcionando, muchas gracias por compartir su conocimiento.

  9. 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.

  10. Great post, Dude………….

  11. 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.

  12. A very useful post.
    now its working..
    thanx.

  13. thanx for this post
    its very helpful for installing magento to local server for testing purpose

  14. 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.

  15. One more thing. Do enable javascript on next page after it worked fine. :)

  16. Thanks a lot mate.. You have save lots of time for me…you rockzzzzz. :)


Who Linked To This Article.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*