phalcon shows directory list following the tutorial with wamp server

I've gone through phalcon's documentation and followed the tutorial provided on the official site:https://docs.phalconphp.com/en/latest/reference/tutorial.html
The problem is when I browse the project (localhost/tutorial) it shows me the directory list as
app/
public/
What am I doing wrong?

Answer:
The .htaccess file for the phalcon directory structure assumes you're working at the web root, not a subdirectory. You'd need to adjust your .htaccess file accordingly if you're not going to follow their proposed directory structure. The .htaccess file they give you is designed to redirect all traffic to the web root to your /public directory thus essentially hiding the /app directory from the web. Try placing their suggested web root .htaccess file in your tutorial directory and add a line RewriteBase /tutorial/. Then place their 2nd .htaccess file in your /tutorial/public directory adjusting its RewriteBase to RewriteBase /tutorial/public/.
Alternatively, you can avoid their public directory altogether and use a safer and faster directory structure, due to avoiding extra RewriteRules, albeit less convenient, by placing your app directory below the web root and adjust your PHP to use either dirname(__DIR__) or .. to refer to the parent directory when attempting to locate your app directory.
A final approach would be to create a subdomain on your localhost, http://tutorial.localhost/, yes localhost subdomains are a great solution for allowing web root access for multiple projects without stepping on each other's toes, then you'd edit your hosts file to add a record for the fake domain mapping it to 127.0.0.1, the same as localhost. Then edit your apache config file adding a virtual host for the subdomain mapping it to a specific directory to use as your web root for that subdomain, reload apache, and presto.

0 Response to "phalcon shows directory list following the tutorial with wamp server"

Đăng nhận xét

Popular Posts

Popular Posts