Pregunta

I am not sure why this is happening as I am not very knowledgeable when it comes to Apache. Below is a copy of my VirtualHost.

If this gives any extra help as to how to get it to work, I am trying to run a CakePHP site. I know the site itself has no issues as I have another location I manage the code from and can get it running locally through Apache there.

<virtualhost *:80>
    DocumentRoot "C:/sites/sitename"
    ServerName dev.sitename.com
    ErrorLog "logs/sitename.com-error.log"
    CustomLog "logs/sitename.com-access.log" common


    <directory "C:/sites/sitename">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order Allow,Deny
        Allow from all
    </directory>
</virtualhost>

I am running this on Apache 2.0 and Win7sp1

UPDATE

I never found the real solution using the route I was on. I downloaded a fresh copy of WAMP and was soon able to get everything up and running, no problem.

¿Fue útil?

Solución

In order to prevent apache from showing the directory listing, you need to disable indexes. Also, it's best to disable MultiViews as that will enable content-negotiating, which may produce unwanted side-effects

Change the options to;

 Options -Indexes FollowSymLinks

Then, check that the .htaccess file is present inside your webroot (C:/Sites/Sitename), as that file is used to enable mod_rewrite

Additional pointers/hints

First of all, make sure that the DocumentRoot is pointing to the right directory of your application;

The standard directory structure of CakePHP looks like this;

app
   /Config
   /Controllers
   /Views
   ......
   /webroot
lib
   /Cale
plugins

The DocumentRoot should point to your `app/webroot' directory, which contains all 'public' files.

Change the paths/directories in your virtual host to that directory and restart Apache.

If you're still getting a 403 error, change the URL you're visiting in your browser to this;

http://mywebsite.com/index.php

If this does work, check if the .htaccess file is present in that directory and mod_rewrite is installed in your Apache.

Otros consejos

According to the answer from "thaJetzah" (sorry, can't comment yet:) )

403 Forbidden is better than having the index of the folder, because now you can see the logs/sitename.com-error.log log and hopefully it tells you, why it gives 403.

Just to make sure: The index.php is in the folder "C:/sites/sitename"?

If you can't isolate the error like this, it would be great to post here the output of the error.log when you try to access the page and it gives you 403.

Check this If you are running Ubuntu.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top