Allow remote access to MYSQL database

To allow remote access to MySql first create a MySql user and assign host as %.

CREATE USER 'newuser'@'%' IDENTIFIED BY 'password';

then grant privileges

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'%';

then flush privileges

FLUSH PRIVILEGES;

You may need to add the following to /etc/mysql/my.cnf to listen for all ip’s instead of just localhost, this will override the setting bind-address = 127.0.0.1

[mysqld]
bind-address = 0.0.0.0

You may also need to allow TCP port 3306 for incoming connections in your firewall for MySql.

Wamp Configuration Virtual Hosts

This guide will change the document root, create a virtual host, bypass proxy(if behind corporate server)for the virtual host.

1. Change 2 entries in httpd.conf

DocumentRoot "c:/wamp/www/"
to
DocumentRoot "d:/webdir/"

and

<Directory "c:/wamp/www/">
to
<Directory "d:/webdir/">

2. Search for and uncomment the line below to enable virtual hosts

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

3. Add a default virtual host and a custom entry by editing the file C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "d:/webroot"
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName site1.local
    DocumentRoot "d:/webroot/site1"
    ErrorLog "site1.log"
    CustomLog "site1.custom.log" common
</VirtualHost>

5. Add entry to hosts file, C:\Windows\System32\drivers\etc\hosts

127.0.0.1      site1.local

6. Restart all services in Wamp

This should work, things to look out for:

Enable Apache Mod_rewrite, although it may appear enabled in Wamp interface also check httpd.conf for the line

LoadModule rewrite_module modules/mod_rewrite.so

If behind proxy server add to exceptions in browser

Force Files To Download Instead Of Open In Web Browser

You can change the file directivies for a folder by adding a .htaccess file in the folder and including the following code:

<IfModule mod_headers.c>
<FilesMatch "\.(?i:mp3|ogg)$">
      ForceType application/octet-stream
      Header set Content-Disposition attachment
</FilesMatch>
</IfModule>

This will force .mp3 and .ogg files to prompt for action rather than open with the default browser setting. The IfModule condition is recommended as it will prevent an error message if the Apache headers module is not installed.

Prevent Access And Directory Listing To A Folder Using .htaccess

If someone browses to a folder on your website that does not have an index file it will, by default, list the directory’s contents. If you have an Apache based web server you can prevent access to this folder by placing a .htaccess file within it containing the following code:

Options -Indexes

This can also be placed at the root of your site as it will be inherited through the sub-directories. Using Options -Indexes does not prevent access to the folders from scripts running on your website so you can still, for example, list the contents with PHP and download the files.