Question

This is my folder structure

+ Duplicate
    + Controllers
        - LoginController.php
    + Models
    + Views
        - Index.php

The contents of my http-vhosts.conf file is:

ServerName example.dev
ServerAlias www.example.dev
DocumentRoot "C:/wamp/www/Duplicate/Views/"
<Directory "C:/wamp/www/Duplicate/Views/"> 

My index file contains a header as such

header("Location: ../Controllers/LoginController.php");

The LoginController never gets loaded. This is what I understand of what's happening.

The URL example.dev always contains /Views/, so even when I try to change the Location header to the parent folder, the path gets appended to my example.dev URL which again contains /Views/.

What am I supposed to do for it to work. I've been stuck all day trying to get it to load the page.

Était-ce utile?

La solution

With this setting you cannot access the LoginController.php, because it differs from the DocumentRoot.

DocumentRoot = C:/wamp/www/Duplicate/Views/
File         = C:/wamp/www/Duplicate/Controllers/LoginController.php

Direct access should only be possible for files, that are in the DocumentRoot (or any of its subfolders).

You maybe can change your DocumentRoot to "C:/wamp/www/Duplicate/" and put an index.php in that folder that redirects you to "Views/".

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top