5

My application url is:

http://localhost/my-app

And my admin panel is here:

http://localhost/my-app/admin

But when I try to access the admin panel using this url:

http://localhost/my-app/admin/

It redirects me to :

http://localhost/admin

Is there any way to prevent this by happening? I want to access the admin panel from this url also.

My htaccess file looks like this currently:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
paulalexandru
  • 9,218
  • 7
  • 66
  • 94
  • Ps. I deleted the "# Redirect Trailing Slashes If Not A Folder..." lines but it still does not work..I restarted the wamp also. – paulalexandru Nov 10 '15 at 07:13
  • Have you tried adding `RewriteBase /my-app` after `RewriteEngine On`? – Tim Nov 10 '15 at 08:06
  • But you got no subdirectory in your production environment. So it should be working, or isn't it? – Tim Nov 10 '15 at 08:17
  • Tim looks to be correct here. When you say "it still does not work" after removing the trailing slashes rewrite rule, what exactly does that mean? Does it still redirect to "/admin" or does it send you somewhere else? – Trip Nov 11 '15 at 03:50
  • It still redirect to "/admin" – paulalexandru Nov 11 '15 at 07:27
  • But isn't that the correct behavior in production? I can understand if that's wrong on your localhost, but in production you have no subdirectory or have you? – Tim Nov 12 '15 at 18:27

1 Answers1

0

I cannot give comment, so i'll try here instead.

you need to remove this line from .htaccess

RewriteRule ^(.*)/$ /$1 [L,R=301]

or add # in front of it to comment.