1

I have laravel framework, I am trying to hide index.php but while I changed in my .htaccess file (Under Public_Html) it's not working properly. Like- If I hide the index.php with common codes all the url apart of home is not functioning. but if I use mydomain.com/index.php/contactus in that case it's working. Please check the code & help

<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_URI} "/application/"
RewriteRule (.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteCond %{THE_REQUEST} ^.*/index\.php 
RewriteRule ^(.*)index.php$ /$1 [R=301,L]

irfan khan
  • 11
  • 1
  • Check this out [link](https://stackoverflow.com/questions/39597693/remove-index-php-from-url-laravel-5-2). It helps you to resolve apache related setting also. – Pramod Patil Dec 12 '17 at 06:46

1 Answers1

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

    RewriteEngine On

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

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

This should do the right job

Insax
  • 612
  • 4
  • 10