Run WordPress in Virtual Host
Posted by: funkyfrank (---.serv98.quikefall.com)
Date: April 15, 2015 04:06PM

Does any one have good and up to date information about how to run WordPress with WAMP from a Virtual Host?

My Virtual Hosts file is pretty simple, so far I run all projects out of a single folder, D:/WEB/WWW.

 <VirtualHost *:80>
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory  "c:/wamp/www">
    	AllowOverride All
	Require local
	Require ip 192.168.188
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "D:/WEB/WWW"
    ServerName workbench.dev
    ServerAlias www.workbench.dev

    <Directory "D:/WEB/WWW">
	AllowOverride all
        Options Indexes FollowSymLinks

    	<IfDefine APACHE24>
    		Require local
    		Require ip 192.168.188
	</IfDefine>

	<IfDefine !APACHE24>
		Order Deny,Allow
    		Deny from all
    		Allow from 127.0.0.0/8 localhost ::1 192.168.188
    	</IfDefine>

    </Directory>
</VirtualHost>

I would love to be able to have WordPress running in a folder inside D:/WEB/WWW, is that possible and how would I go about it?

In this tutorial How to install wordpress locally with wamp for beginners = [www.youtube.com] the WordPress folder is on C:\ however I do frequent restores to various OS images so I would like to have WP on D and not on C.

I assume it does not matter really where the WP folder is as long as the Virtual Host file is set up.

What would or could an example Virtual Host file look like for a WP installation on let's say D:/WEB/WWW/WP/ ?

What about PHPMyAdmin? Do I need to change the path to the database there too if WP is on D:/WEB/WWW/WP/ ? How would I go about that please?

For example in the wp-config-sample.php file instead of localhost I would put NOTHING else since localhost is redirected using the Virtual Host so I can simple just copy and paste the WP contents into any folder on D:/WEB/WWW/ and it should work from inside that?
/** MySQL hostname */
define('DB_HOST', 'localhost');

Thank you for any help or if nothing a sample Virtual Hosts file for WP NOT on C, I will try and work it out somehow.

Thank you to anybody that is willing to share their insights!!

EDIT
OK, it worked out with the Virtual Host file. I just dropped the WP download to D:/WEB/WWW/WP/ made a database called dev in [localhost], loaded Folder WP through workbench.dev and it started with the installation. Here my wp-config.php file.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'dev');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', '');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

It seems a bit slow (taking some seconds to load Dashboard for example, though running locally, am I doing something wrong?

EDIT2
Permalink Settings - Post Name - Virtual Host:
When going here //workbench.dev/WP/wp-admin/options-permalink.php and changing the Permalink Settings to Custom Structure and having /%postname%/, so to speak Post Name setting, the blog posts, for example, //workbench.dev/WP/hello-world/ cannot be found. I assume this is due to me running this over Virtual Host from a folder instead of from C:\ ??

How can I make WP accept Post Name as Permalink Setting when running WP from inside a folder through a Virtual Host? I think this is really what I need to know, thank you for any help.

Best Regards

Thank you for any help!!

Version of Operating system? Windows 7 Ultimate 64bit
Version of Wamp Server installed? 2.5 32bit
Version of Apache you are running? 2.4.9
Version of MySQL you are running? 5.6.17
Version of PHP you are running? 5.5.12
What colour is your WampManager icon? Green
Host file localhost 127.0.0.1

New to WAMP?
Read this please: [forum.wampserver.com]



Edited 6 time(s). Last edit at 04/15/2015 06:47PM by funkyfrank.

Options: ReplyQuote
Re: Run WordPress in Virtual Host
Posted by: RiggsFolly (---.as43234.net)
Date: April 15, 2015 09:14PM

RE: Speed

Try changing this from
/** MySQL hostname */
define('DB_HOST', 'localhost');

To
/** MySQL hostname */
define('DB_HOST', '127.0.0.1');

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Run WordPress in Virtual Host
Posted by: funkyfrank (---.serv98.quikefall.com)
Date: April 15, 2015 10:33PM

RE: Speed
Thank you, I will give it a shot.


RE: EDIT2
In case other people are looking for this info.

Using Permalinks as Post Name [codex.wordpress.org]

Quote

4. Users of WAMP (Windows): Some versions of WAMP (all versions?) do not enable mod_rewrite or permit following SymLinks by default.

To enable the required functionality navigate to the apache/conf/httpd.conf file, open with a text editor and uncomment the line LoadModule rewrite_module modules/mod_rewrite.so

(i.e., delete the hash/pound sign at the front of the line).

Then further down in the same file there is a section that starts with the line "Options FollowSymlinks".

Change the second line in that section from "AllowOverride none" to AllowOverride all.

Save edited httpd.conf and restart all WAMP modules. Your permalinks should now work.

Worked straight away! smiling smiley


How to run multiple sites in the WP folder without installing WP again and again, use MultiSite/WP Network

Running more than one site on localhost [wordpress.org]

P.S.:
Must say, all of this would not have been that easy to figure out if I would not have spent the time initially to read the post linked in my signature, the forum sticky about Virtual Hosts. Understanding THAT really helped me and now things seem a breeze, as you can see from the EDITs above. Thank you tremendously Riggs!!

Version of Operating system? Windows 7 Ultimate 64bit
Version of Wamp Server installed? 2.5 32bit
Version of Apache you are running? 2.4.9
Version of MySQL you are running? 5.6.17
Version of PHP you are running? 5.5.12
What colour is your WampManager icon? Green
Host file localhost 127.0.0.1

New to WAMP?
Read this please: [forum.wampserver.com]

Options: ReplyQuote


Sorry, only registered users may post in this forum.