Reputation: 121
My problem maybe easy to solve, but I really can't figure it out.
I followed the instructions in the book "Beginning Zend framework" creating a new project. The project has 2 controllers 'account' and 'artist'. Here is the tree view of /application:
.
├── application
│ ├── Bootstrap.php
│ ├── configs
│ │ └── application.ini
│ ├── controllers
│ │ ├── AccountController.php
│ │ ├── ArtistController.php
│ │ ├── ErrorController.php
│ │ └── IndexController.php
│ ├── models
│ └── views
│ ├── helpers
│ └── scripts
│ ├── account
│ │ ├── activate.phtml
│ │ ├── index.phtml
│ │ ├── new.phtml
│ │ └── success.phtml
│ ├── artist
│ │ ├── index.phtml
│ │ └── list-all-artists.phtml
│ ├── error
│ │ └── error.phtml
│ └── index
│ └── index.phtml
How can I setup document root to access /account/new.phtml, for example? (When typing 127.0.0.1, I can see the default index page "Welcome to the Zend Framework!", but I don't know how to access other pages).
More information: +) The document root is /.../public/ (which contains .htacess and index.php) +) 127.0.0.1/index also returns that page, but 127.0.0.1/index/index.phtml does not work. http://127.0.0.1/account, http://127.0.0.1/artist return 404 error.
Upvotes: 1
Views: 1913
Reputation: 927
Welcome to ZF! A personal thing I do is always setup a Vhost, rather than just use the standard "localhost
". This really helps with the management of separate projects, and allows you to store it in an easier location.
If you try to do localhost/account, what happens? If you get any type of errors, then you haven't setup Apache properly. Here's a sample Vhost
that I use:
<VirtualHost *:80>
ServerName project.local
DocumentRoot "C:\xampp\htdocs\project\public"
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "C:\xampp\htdocs\project\public">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Go ahead and try to do something similar, and create the respective line in your HOSTS
file, clear your cache, and you should be set!
Also, in your structure, I noticed you're missing a public
folder. Be sure you have one, along with a .htaccess
to rewrite to index.php
. Edit: just saw your edit, you should already have this taken care of.
Upvotes: 2