How to [always] redirect localhost to 127.0.0.1 when i type localhost?

Hi,
Is there any way to redirect localhost to always redirect to 127.0.0.1 when i type localhost ??

OS: Windows 8 32bit
Test Server: WAMP
Purpose: Testing Magento. and Admin login is not working on localhost. but working on 127.0.0.1.
but the problem is 127.0.0.1 keep redirecting to localhost! ๐Ÿ‘€

TIA. ๐Ÿ˜€
Big_B

Replies

  • Kaustubh Katdare
    Kaustubh Katdare
    localhost = 127.0.0.1 . I'm not sure where your browser is taking you. You may try editing hosts file : Editing C:\Windows\System32\drivers\etc\hosts file on Windows Vista and add entry-

    127.0.0.1 localhost
  • Manish Goyal
    Manish Goyal
    Big_B
    Hi,
    Is there any way to redirect localhost to always redirect to 127.0.0.1 when i type localhost ??

    OS: Windows 8 32bit
    Test Server: WAMP
    Purpose: Testing Magento. and Admin login is not working on localhost. but working on 127.0.0.1.
    but the problem is 127.0.0.1 keep redirecting to localhost! ๐Ÿ‘€

    TIA. ๐Ÿ˜€
    Big_B
    That's strange, which browser are you working on?
  • Big_B
    Big_B
    Kaustubh Katdare
    localhost = 127.0.0.1 . I'm not sure where your browser is taking you to. You may try editing hosts file : Editing C:\Windows\System32\drivers\etc\hosts file on Windows Vista and add entry-

    127.0.0.1 localhost
    I have the same code as you suggest in host file!

    127.0.0.1      localhost
    I face this problem only when i try to login to admin panel of Magento.
    otherwise everything works fine. ๐Ÿ˜€

    I have search on the Google on this problem and find a solution to update core file that solve the problem but #-Link-Snipped-# also said that,

    We do not recommend this solution for a production version of Magento, but for you local test environment this will work.
    is there any proper solution for this?
  • Big_B
    Big_B
    Manish Goyal
    That's strange, which browser are you working on?
    I am Using Chrome 30.0.1599.101
  • Manish Goyal
    Manish Goyal
    I don't remember exactly what I did for Magento last time when I had worked 2 years ago

    Just add one more entry to hosts file 127.0.0.1 xyz.com

    Then restart xampp or wamp and open xyz.com/magento, I don't which config file to edit, you can simply re-install magento
  • Kaustubh Katdare
    Kaustubh Katdare
    @#-Link-Snipped-# - You could quickly post the contents of your hosts file?
  • Big_B
    Big_B
    Kaustubh Katdare
    @#-Link-Snipped-# - You could quickly post the contents of your hosts file?
    Here is the content of host file:

    # Copyright (c) 1993-2009 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97    rhino.acme.com          # source server
    #      38.25.63.10    x.acme.com              # x client host
    
    # localhost name resolution is handled within DNS itself.
    #    127.0.0.1      localhost
    #    ::1            localhost
    
    127.0.0.1      localhost
  • Kaustubh Katdare
    Kaustubh Katdare
    The hosts file looks okay. Since you're in Windows 8 environment, it will try to figure out the IPv6 addresses first before IPv4. Could you try totally removing

    # ::1 localhost

    from the file and then restarting your apache server? If that doesn't work, we'll have to make edits to the apache configuration (I think).
  • Kaustubh Katdare
    Kaustubh Katdare
    Update: If that doesn't work for you,

    edit httpd.conf file and change -

    Listen 80
    TO
    Listen 0.0.0.0:80
    Restart Apache and let us know if everything works fine for you. What this option does is ignore all the IPv6 range. Do restore it once you're done with your work on WAMP and you really want IPv6 powers ๐Ÿ˜€
  • Big_B
    Big_B
    Manish Goyal
    I don't remember exactly what I did for Magento last time when I had worked 2 years ago

    Just add one more entry to hosts file 127.0.0.1 xyz.com

    Then restart xampp or wamp and open xyz.com/magento, I don't which config file to edit, you can simply re-install magento
    I am running it on local so 127.0.0.1 xyz.com wont work, as it will be point to some actual domain xyz.com in this case.

    Re-installing will lost my all work. so finding the solution.
  • Manish Goyal
    Manish Goyal
    can you give me remote control of your system via team viewer?

    PM me your TV ID
  • Big_B
    Big_B
    Nothing working guys....
    Anyways re-install it Finally, all the things back to normal.
    Might be some problem with previous installation or else..

    Thank you guys for the quick support. ๐Ÿ˜€
    Tag: #-Link-Snipped-# , #-Link-Snipped-#

    --
    Big_B
  • Kaustubh Katdare
    Kaustubh Katdare
    @#-Link-Snipped-# - Did you try editing the httpd.config file to reflect the settings I mentioned above? That should work. Give it a try before you decide on starting from scratch.

    PS: If you have reinstalled everything by now, please let us know whether that solved the problem.
  • Big_B
    Big_B
    Kaustubh Katdare
    @#-Link-Snipped-# - Did you try editing the httpd.config file to reflect the settings I mentioned above? That should work. Give it a try before you decide on starting from scratch.

    PS: If you have reinstalled everything by now, please let us know whether that solved the problem.
    Yes first i have try editing httpd.config file as you said, but unfortunately that doesn't solve the problem.

    I Just Re-install the Magento... ๐Ÿ˜€

    Solution that work for me:
    On the installation they ask for the host name, if you type localhost there it wont work as happened with me, so this time instead of localhost i type 127.0.0.1 and that works. ๐Ÿ˜€
  • Kaustubh Katdare
    Kaustubh Katdare
    So the fix is that at the time of Magento, when the installer asks for the host name, choose 127.0.0.1 instead of localhost. If you set that option, Magento admin panel works on both #-Link-Snipped-# & #-Link-Snipped-# . Please confirm.
  • Big_B
    Big_B
    In a way, No that wont work on the localhost now.
    But it will redirect you (everytime) to #-Link-Snipped-# if you type #-Link-Snipped-# and where that will work as we have set that host 127.0.0.1 at installation. ๐Ÿ˜€
  • Romulo F. F.
    Romulo F. F.
    Hello #-Link-Snipped-#
    I was trying something similar to your solution as I'mrunning Magento with wamp 2.5, but wasn't having success and receiving an error on magento install with ip adress instead of localhost.
    If anyone have this problem, check the database user, mine was specified 'machine' localhost, and i changed to 'any machine' (%).

    After reinstalling, I searched the differences too, so i think that the problem can be solved withou reinstalling doing the following operations:
    1) change app\etc\local.xml from localhost to your ip adress
    2) in the database, change table 'core_config_data', change column 'path' 'value' from paths: 'web/unsecure/base_url' and 'web/secure/base_url'.
  • Big_B
    Big_B
    Cool! Nice Idea Romulo. Will try and post here if i find any issue. Thanks.๐Ÿ‘

You are reading an archived discussion.

Related Posts

Sachin Tendulkar will become the first sportsman to get India's highest civilian award - Bharat Ratna. I personally do not follow cricket and have always treated every sport equally. I...
Can anyone help me out with the following topics. I need to know about these topics. 1.Zero C.T.E (Coefficient of Thermal Expansion) laminates 2.Thermally Quasi-isotropic laminates 3.C.T.E for special laminates...
Hi everyone, I was thinking to plan a mock test for pharmacy students. I am not sure which platform to choose. there a few online exam providers (which are charging...
Scientist CNR Rao isn't happy with the politicians and Indians in general, it seems. After calling politicians 'Idiots' for giving so little (resources, funding) to the scientists he went on...
I just want a ranking of cdac centers in pune.