Hello,

I am searching the net for hours now trying to find a solution to my problem, found tutorials and forums posts but can't solve my problem.

Please help.

windows 7, WAMP 2.2 (apache 2.4.2)

Trying to set up a virtual host outside of the wamp directory getting the error:
You don't have permission to access / on this server.

What I have now:
directory: c:\sites
Permissions:
Full Control:
Authenticated Users
SYSTEM
Administrators(MYUSERNAME\Administrators)
Users(MYUSERNAME\Users)

In my httpd-vhosts.conf file, under:

<VirtualHost *:80>
    DocumentRoot "C:/sites/highland"
    ServerName highland.local
    Options Indexes FollowSymLinks
</VirtualHost>

In my httpd.conf file:

DocumentRoot "c:/wamp/www/"
<Directory "c:/wamp/www/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    # Online --> Require all granted

    #   onlineoffline tag - don't remove

    Require local

</Directory>

DocumentRoot "c:/sites/"
<Directory "c:/sites/">
    AllowOverride All
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

In my hosts file:
127.0.0.1 highland.local

What am I doing wrong?

Dani AI

Generated

Brief note anchored to the existing thread: the "You don't have permission to access / on this server" error when the site files are moved outside WAMP almost always comes from Apache directory access rules or mismatched Apache 2.4 directives, not from CodeIgniter itself. 's phpMyAdmin alias change is unrelated to vhosts. was right to suggest a Directory block inside the vhost, but Apache will refuse to start or still return 403 if the Directory syntax or access rules are incorrect (and Apache 2.4 changed access control syntax).

A minimal Directory example (uses Apache 2.4 syntax) that should be added for each vhost DocumentRoot:

<Directory "C:/sites/highland">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Troubleshooting checklist and safe steps (apply in order):

  • Put a simple static file (index.html) into the external DocumentRoot and try to load it. If it serves, .htaccess or mod_rewrite is not the cause.
  • Confirm the vhost has a matching Directory for the exact DocumentRoot path (use double quotes for Windows paths).
  • Convert any legacy Order/Deny/Allow lines to the Apache 2.4 Require form, or explicitly load mod_access_compat if keeping old syntax. Mixing both can cause unexpected 403s.
  • Ensure AllowOverride All if .htaccess needs to control rewrites, and verify mod_rewrite is enabled.
  • Run Apache config diagnostics from an elevated command prompt: httpd.exe -t and httpd.exe -S (as recommended) to catch parse errors and see which vhost is selected.
  • If Apache won't start after edits, check for unclosed tags or bad paths in the vhost file and inspect the error log and Windows Event Viewer for parse errors.
  • Verify the Windows account Apache runs under (service Log On) has read/execute on the external folder.

Summary: add a precise Directory block using Require all granted for each external DocumentRoot, confirm AllowOverride/mod_rewrite, test with a static file, then use httpd.exe -t/-S and the error log to trace any remaining problems. This sequence resolves the vast majority of 403s for sites outside the WAMP folder.

Recommended Answers

All 5 Replies

Go to C:\wamp\alias. Open the file phpmyadmin.conf and change

<Directory "c:/wamp/apps/phpmyadmin3.5.1/"> // This depends on the version of php u r using
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

TO

<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Allow,Deny
    Allow from all
</Directory>

I hope thet works out for you

Hi,
Sorry saw your answer only now. Didn't help.

Posting what I did again as I am trying to do it for a few days now and the situation might have changed:

I am trying to create Virtual hosts for 3 days now.

I even managed to break WAMP totally and had to reinstall it.

I read lots of tutorials and forum posts.

Nothing works !!!

PLEASE HELP ME

Windows 7, WAMP 2.2e

I have 2 local sites, ruthrudincom and thinklocal.
If I leave them both in wamp/www - ruthrudincom is working thinklocal gives me access denied.
Thinklocal is developed with codeigniter and has htaccess file.

If I move them to c:/www none is working - access denied. (I went to c:/www and gave all permissions to all users)

My files:
httpd_conf:

<Directory "c:/wamp/www/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    # Online --> Require all granted

    #   onlineoffline tag - don't remove

    Require local

</Directory>
<Directory "c:/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory> 

hosts file I added these lines:
127.0.0.1 ruthrudincom.dev
127.0.0.1 thinklocal.dev

httpd_vhosts: (DocumentRoot tried with wamp and without wamp)

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:/wamp/www"
ServerName localhost
ServerAlias localhost
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin admin@ruthrudincom.dev
    DocumentRoot c:/wamp/www/ruthrudincom
    ServerName ruthrudincom.dev
    ErrorLog "logs/ruthrudincom.dev-error.log"
    CustomLog "logs/ruthrudincom.dev-access.log" common
</VirtualHost>

#Think local
<VirtualHost *:80>
    ServerAdmin admin@thinklocal.dev
    DocumentRoot c:/wamp/www/thinklocal
    ServerName thinklocal.dev
    ErrorLog "logs/thinklocal.dev-error.log"
    CustomLog "logs/thinklocal.dev-access.log" common
</VirtualHost>

The htaccess file:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    #RewriteCond $1 !^(index\.php|assets|images|robots\.txt|captcha|favicon\.ico)
    #RewriteRule ^(.*)$ /thinklocal.dev/index.php/$1 [L]  


    # Send request via index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    RewriteRule ^(.*)$ /index.php?/$1 [L]   
</IfModule>

Please, can someone help?

I evern tried installing php, mysql, apache by themeselves with no WAMP, nothing works.

As suggested before you have to enable the reading of .htaccess, so inside Thinklocal add:

#Think local
<VirtualHost *:80>
    ServerAdmin admin@thinklocal.dev
    DocumentRoot c:/wamp/www/thinklocal
    ServerName thinklocal.dev
    ErrorLog "logs/thinklocal.dev-error.log"
    CustomLog "logs/thinklocal.dev-access.log" common

    <Directory /> # relation with DocumentRoot
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All # allow .htaccess
        Order allow,deny
        Allow from all
    </Directory>

    # prevent remote access to .htaccess and .htpasswd
    <FilesMatch "^.ht">
        order allow,deny
        deny from all
    </FilesMatch>

</VirtualHost>

You can do the same with ruthrudincom.dev, once edited reload the server and it should work. Bye!

cerel, thanks but adding your code just makes the Apache server stop working.

Restarting WAMP, and apache does not start and there is no error in the error log file.

I tried 3 ways:
<Directory /> # relation with DocumentRoot
<Directory "c:/wamp/www/thinklocal"> # relation with DocumentRoot
<Directory c:/wamp/www/thinklocal> # relation with DocumentRoot

Unfortunately I cannot access to a Windows box to try WAMP by myself, however the suggested configuration is working well for me on linux. Just try to test the config removing all the comments, or test thinklocal.dev alone:

NameVirtualHost *:80
Listen 80

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "C:/wamp/www"
    ServerName localhost
    ServerAlias localhost
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin admin@ruthrudincom.dev
    DocumentRoot c:/wamp/www/ruthrudincom
    ServerName ruthrudincom.dev
    ErrorLog "logs/ruthrudincom.dev-error.log"
    CustomLog "logs/ruthrudincom.dev-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin admin@thinklocal.dev
    DocumentRoot c:/wamp/www/thinklocal
    ServerName thinklocal.dev
    ErrorLog "logs/thinklocal.dev-error.log"
    CustomLog "logs/thinklocal.dev-access.log" common
    <Directory />
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    <FilesMatch "^.ht">
        order allow,deny
        deny from all
    </FilesMatch>
</VirtualHost>

Make sure that logs directory exists under the declared ServerRoot and has write permissions.

So, while waiting for help by others members, all I can do is to suggest you to post the complete httpd_vhosts and troublueshooting to get some output from Apache, you can try to run Apache manually, by opening the command prompt (Start > Run > cmd.exe) as Administrator and running httpd.exe:

httpd.exe -S
httpd.exe -t -D DUMP_VHOSTS

The command httpd.exe can be found somewhere under the installation "Wamp directory\...\bin", but you can also use dir to get the correct path: dir /s httpd.exe

The first command will:

Show the settings as parsed from the config file (currently only shows the virtualhost settings).

The second instead:

Run syntax tests for configuration files only. The program immediately exits after these syntax parsing tests with either a return code of 0 (Syntax OK) or return code not equal to 0 (Syntax Error). If -D DUMP_VHOSTS is also set, details of the virtual host configuration will be printed. If -D DUMP_MODULES is set, all loaded modules will be printed.

Here you can find more information & configuration examples:

Good luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.