I've Great Problem With my Localhost Server Configuration Please Help Me

Hi EveryOne
Please Anyone help me.
I have a web site based on wordpress software (http://my-complain.com). Now I have downloaded my SQL database and configure with my localhost server (Offline). I can open my site’s home page on my localhost server. But I’ve a problem when I click the any post or try to login or other links then it redirect me to online site (http://my-complain.com). Now how can I operate my site with my localhost server (Offline)? I mean I want to view my all post with localhost server. Is it possible? If anyone help me this is great pleasure to me. Please help me. Please…

Hi,

You need to set a local host file:

Windows:

Edit c:\windows\system32\drivers\etc\hosts file: like

127.0.0.1      my-complain.com

This means that when you browse to my-complain.com you will route to the machine where the local host file is set. If you need to route to a different machine on your internal network then an example is:

172.16.2.34      my-complain.com

On Windows 7 and Vista you may need to be administrator to do this.

Macintosh:

Set a local host file in Mac OS X

Linux:

Edit the /etc/hosts file:

127.0.0.1      my-complain.com

Regards,
Steve

WAIT! DON’T DO THAT!

With deference to Steve, that will disable your viewing your online website which, IMHO, is a horrid thing to do!

The way I’ve setup my test server is to remove the domain extension (.tld) OR merely use my own acronym for my online domains. Yes, update the hosts file (using 127.0.0.1) and your httpd-vhosts.conf with the extensionless domain name or acronym.

THEN you will have to alter your test server’s WP configuration file (by removing the .tld or replacing with the acronym). After that, you’ll be set to duplicate and properly test on your own server.

FWIW, Steve’s comment about Win7/Vista is golden but doesn’t go far enough. I’ve installed my PHP and Apache on a drive partition to keep as far away from WinDoze’s “protection” so that I can actually test my files on my test server and recommend that (with the obvious exception of the the WinDoze hosts file which requires Admin access to save any changes you make there).

Regards,

DK

Its been a long time since I’ve done this as I run an Internal DNS and forwarder so your suggestion of using a host alias ie. my-complain minus the .com and the same correction in the virtual host and WP is a good solution. Thanks DK :slight_smile:

Thanks all of you. But Which suggestion right for me. Please. I am using Win Vista. I need right suggestion. Please.

Hi ronisdj,

DK is suggesting and I agree that setting a local host is the right idea, so here is what to do:

  1. set your windows host file here - c:\windows\system32\drivers\etc\hosts to
    [COLOR=#464646][FONT=Helvetica Neue]127.0.0.1 my-complain[/FONT][/COLOR]
    do not use .com, simply use my-complain
  2. open your httpd-vhosts.conf file (if using XAMP this will be found inside the XAMP directory); or wherever you installed Apache, and add a virtual host using my-complain as an extension-less domain
  3. in Wordpress edit the configuration to use the extension-less name.
  4. restart apache

DK also recommended that you don’t have your Apache environment running with your OS drive and instead install and run it from a separate drive. If your Apache was installed using the default install then your Apache will be inside your OS drive, so don’t bother changing it now.

Steve

Dear ServerStorm Sir
I can’t configure httpd-vhosts.conf file. Please tell me details. How can I do this. Please. Please.

Why can’t you configure this file. Do you not know where to find it or don’t know what to put into the vhosts file?

take a look at this Creating virtual hosts on Apache 2.2 article that gives a pretty good walk-through of the entire process.

Steve

Steve,

He can’t edit the httpd.conf without opening his editor with Run As Administrator BECAUSE he’s installed it in Program Files (ergo, my admonition to install it elsewhere). Being stuck with his installation, he can use a good text editor (by definition, that excludes NotePad) by right clicking it’s icon and selecting Run As Administrator. Then, from the editor’s menu, Open httpd.conf, httpd-vhosts.conf and/or hosts in their directories (c:\Program Files\Apache Foundation\Apache 2.2\conf(\extras for the vhosts file) or the file location you specified above for hosts. DON’T FORGET TO SAVE the file after editing! For me, the PITA that WinDoze is forcing with its “protected directories” is enough reason to uninstall and reinstall in a different drive partition - but, as a professional webmaster, I edit frequently.

Regards,

DK