Why is mod_rewrite not working in the site root?

Have this setup .htaccess to addresses like /asda/asda/ and other call forwarding works as expected, but if you just open site.ru/ the app.php doesn't work, instead the welcome page of apache spits. Prompt if not difficult.

Spent a couple of hours first, so that thought doesn't work with mod_rewrite, but was working, just not on the main... whew...

Thank you!

<ifmodule mod_rewrite.c>
 RewriteEngine On
 Options +FollowSymlinks
 #RewriteBase /

 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ app.php?u=$1 [L,QSA]
</ifmodule>
June 27th 19 at 15:21
2 answers
June 27th 19 at 15:23
Solution
DirectoryIndex app.php

<ifmodule mod_rewrite.c>
...</ifmodule>


Help. Or in the server settings look for where the indices are assigned.

Directorylndex
This Directive allows you to specify the name of the document returned by the query, which does not contain in the URL string of the document name. For example, in the URL, the www / no title of the document, so the document will be returned specified in the Directive Directorylndex. Since the default name index.html the server will give the client a document index.html from DocumentRoot directory on the server.
Yes, too clear, but why is sought index.php if there is a redirect? - Juana95 commented on June 27th 19 at 15:26
Moreover, RewriteRule ^(.*)$ index.php?u=$1 [L,QSA] DirectoryIndex will work without
and proignorit index.html - hipolito_Trantow20 commented on June 27th 19 at 15:29
Probably / is processed before the ReWrite and does not run it. - hipolito_Trantow20 commented on June 27th 19 at 15:32
Found on StackOwerflow, try:

RewriteRule (.+) /app.php?url=$1 [QSA,NS]
RewriteRule ^(.*)$ app.php?u=$1 [L,QSA]

I like works. - hipolito_Trantow20 commented on June 27th 19 at 15:35
June 27th 19 at 15:25
Root is searched index.html, php, etc., Specify the index file app.php
Yes, I understand.
Or Vice versa, rename app.php
And why is he looking for? Why ignore the rule? - Juana95 commented on June 27th 19 at 15:28
Rewrite Apache and nginx as you need. Strange question - because gladiolus. But in the name of the index mean nothing to you? - hipolito_Trantow20 commented on June 27th 19 at 15:31
By the way, who said that the rule is ignored? The lack of strings is a string or not? - hipolito_Trantow20 commented on June 27th 19 at 15:34

Find more questions by tags Apache