following this tutorial : http://fatfreeframework.com/routing-engine, after adding
$f3->route('GET /about','WebPage->display');
the url localhost/myproject/ works fine, but localhost/myproject/about doesnt work.
To solve the problem, follow these steps:
1. create a file name .htaccess with the following content:
# Enable rewrite engine and route requests to framework
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
# Disable ETags
<IfModule mod_headers.c>
Header Unset ETag
FileETag none
</IfModule>
# Default expires header if none specified (stay in browser cache for 7 days)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A604800
</IfModule>
The error happens because is missing the .htaccess file in the right place:
\htdocs\myproject
\htdocs\myproject\.htaccess -- add htaccess file here
\htdocs\myproject\index.php
\htdocs\myproject\libs
\htdocs\myproject\libs\fatfree-master
......
\htdocs\myproject\libs\fatfree-master\.htaccess -- here is a htaccess file that is not used at all
......
\htdocs\myproject\libs\fatfree-master\lib
\htdocs\myproject\libs\fatfree-master\lib\audit.php
\htdocs\myproject\libs\fatfree-master\lib\auth.php
\htdocs\myproject\libs\fatfree-master\lib\base.php
......
......
.....
Resource:
https://github.com/bcosca/fatfree/blob/archive/f3-2.1.0-blog.example.zip
$f3->route('GET /about','WebPage->display');
the url localhost/myproject/ works fine, but localhost/myproject/about doesnt work.
To solve the problem, follow these steps:
1. create a file name .htaccess with the following content:
# Enable rewrite engine and route requests to framework
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
# Disable ETags
<IfModule mod_headers.c>
Header Unset ETag
FileETag none
</IfModule>
# Default expires header if none specified (stay in browser cache for 7 days)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A604800
</IfModule>
2. put the .htaccess file in the root of wour project, ie {apacheserverdir}\htdocs\pyproject\.htaccess
The error happens because is missing the .htaccess file in the right place:
\htdocs\myproject
\htdocs\myproject\.htaccess -- add htaccess file here
\htdocs\myproject\index.php
\htdocs\myproject\libs
\htdocs\myproject\libs\fatfree-master
......
\htdocs\myproject\libs\fatfree-master\.htaccess -- here is a htaccess file that is not used at all
......
\htdocs\myproject\libs\fatfree-master\lib
\htdocs\myproject\libs\fatfree-master\lib\audit.php
\htdocs\myproject\libs\fatfree-master\lib\auth.php
\htdocs\myproject\libs\fatfree-master\lib\base.php
......
......
.....
Resource:
https://github.com/bcosca/fatfree/blob/archive/f3-2.1.0-blog.example.zip
No comments:
Post a Comment