Problem about mod_rewrite
- kolega
- Member | 4
Hello,
I started learning Nette … But i have problem, that my link is not working.
<h2><a href="{link Problem:show $error->id}">{$error->title}</a></h2>
It leads only to “apache2 404 error page”.
I found on some topics to turn on mod_rewrite (which is on).
The app is in root directory of Apache2 on Ubuntu (/var/www/html/)
You can test the problem on http://neprevazka.tk/www/
Read something about changing the .htaccess file, but which one and how?
Ty for your adwises.
Regards,
- kolega
- Member | 4
Already have that there … All I can see is the Apache 404 error… I think that problem is that for some reason the Nette is not translating my url into app url …
Nothing found in log directory (cause Nette cant be running if webserver
sends 404)
[Edit]
The problem is definetly in Webserver, cause Die command in bootstrap file
causes nothing
http://neprevazka.tk/…problem/show?… (this is the
address)
I think I have some problem in some .htaccess file, but dunno in which.
Last edited by kolega (2015-10-22 22:38)
- Čamo
- Member | 798
If you app root is not in the servers root you should add .htaccess redirect to www. You can find it here: https://doc.nette.org/…ubleshooting#….
Last edited by Čamo (2015-10-22 22:37)
- kolega
- Member | 4
I have the nette app direct in root folder of my webserver
(/var/www/html)
Like these files
app
bin
composer.json
composer.lock
.htaccess
log
nette
owncloud
readme.md
temp
tests
vendor
www
Your solution didnt work (.htaccess in /var/www/html folder) :(
(btw. Ty for your time ;) )
- Čamo
- Member | 798
Once again. If your server root !== app root you have to use .htaccess in the server root and redirect to www. App root is www folder. And your www is not server root. App root is where index.php is stored. It is not app folder.
EDIT: log and temp directory must be writable. Also show us both .htaccess files.
Last edited by Čamo (2015-10-23 15:00)
- kolega
- Member | 4
Yeah it is in webserver root …
`
> ./vendor/.htaccess <
Order Allow,Deny
Deny from all
> ./www/.htaccess <
# Apache configuration file (see httpd.apache.org/docs/current/mod/quickreference.html)
# disable directory listing
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# enable cool URL
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# prevents files starting with dot to be viewed by browser
RewriteRule /\.|^\. – [F]
# front controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz|map)$ index.php
[L]
</IfModule>
# enable gzip compression
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
application/javascript application/json application/xml image/svg+xml
</IfModule>
</IfModule>
> ./.htaccess <
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?neprevazka\.tk$
RewriteRule ^$ www/ [L]
RewriteCond %{HTTP_HOST} ^(www\.)?neprevazka\.tk$
RewriteRule (.*) www/$1 [L]
> ./app/.htaccess <
Order Allow,Deny
Deny from all
> ./log/.htaccess <
Order Allow,Deny
Deny from all
> ./temp/.htaccess <
Order Allow,Deny
- Čamo
- Member | 798
Is obviouse that your server root does not redirect to www folder.
Also it looks like you haven't any ErrorPresenter – http://neprevazka.tk/…6e3e02a.html
EDIT:
I can list whole your project. It means this two directives does not work:
Order Allow,Deny
Deny from all
Something is wrong with .htaccess setting. Try to ask server administrator
why it doesn't work.
Please use formating for code.
Last edited by Čamo (2015-10-26 16:20)