1

My url is like this : http://31.220.56.75/mysystem/public/index.php/login

I want remove index.php, to be like this : http://31.220.56.75/mysystem/public/login

My .htaccess :

<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]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

I try some tutorial di google. but I don't find the solution

Update :

I try update .htaccess like this :

<IfModule mod_rewrite.c>
   RewriteEngine On 
   RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

It's not working

samuel toh
  • 6,836
  • 21
  • 71
  • 108

3 Answers3

0

Try this

<IfModule mod_rewrite.c>
 RewriteEngine On 
  RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Ehsan Ali
  • 1,362
  • 5
  • 25
  • 51
0

default .htaccess in public folder should be working very fine. check: original .htaccess

M.Elwan
  • 1,904
  • 1
  • 16
  • 21
0

Follow the below .htaccess file, hopefully this will work.

If your are facing the issue of $_GET variable also i.e If your both URL index.php and without index.php is working but $_GET variables found not working, then the below of .htaccess code will work for you.

DirectoryIndex index.php
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]
    RewriteRule .? %{ENV:BASE}/index.php [L]

</IfModule>
Mahesh Yadav
  • 2,416
  • 20
  • 23