mod_rewrite works incorrectly on apache 2.4

224 Views Asked by At

I have used other host before, all works fine, but now I have changed it to new one. On new host is installed apache 2.4.

I have the next rules:

<IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteBase /
        RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
        RewriteRule ^/?(.*) http://%1/$1 [L,R=permanent]

        RewriteRule manage/ajax/(.*?)$ manage/ajax/index.php [QSA,L]
        RewriteRule manage/json/(.*?)$ manage/json/index.php [QSA,L]

        RewriteCond %{REQUEST_URI} !\.(.+)$
        RewriteRule ckfinder/(.*?)$ ckfinder/index.html [QSA,L]

        RewriteCond %{REQUEST_URI} !\.(.+)$
        RewriteRule manage/(.*?)/$ manage/index.php [QSA,L]

        RewriteCond %{REQUEST_URI} !\.(.+)$
        RewriteRule ajax/(.+?) ajax/index.php [QSA,L]

        RewriteCond %{REQUEST_URI} !\.(.+)$
        RewriteRule api/(.*?) /api/index.php [QSA,L]

        RewriteCond %{REQUEST_URI} !\.(.+)$
        RewriteRule (.*) index.php
</IfModule>

When I try to access for example /manage/ it show me index page, but if I will add some additional data to the path it will show me what I required. For example: /manage/some_data - Will work fine. But I want to access correct directory by just /manage/.

1

There are 1 best solutions below

6
On

Change this rule:

RewriteCond %{REQUEST_URI} !\.(.+)$
RwriteRule manage/(.*?)/$ manage/index.php [QSA,L]

To

RewriteCond %{REQUEST_URI} !\.(.+)$
RwriteRule manage(/.*)?$ manage/index.php [QSA,L]