Reputation:
I want to remove index.php
from my URL and updated my .htaccess
file with following code.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
but it didn't work for me. To check whether the .htaccess
file is working, I removed all codes from file however my project is still working fine with index.php
. That means my project is working without .htaccess
file? then how can I remove index.php
with the help of .htaccess
file?
I am using linux server.
Upvotes: 1
Views: 356
Reputation: 128
Remove the index.php from url: hope it helps you.
1) Rename the server.php file with index.php, which is in your project root directory.
2) And Copy the .htaccess file from public folder and paste it root directory.
Upvotes: 0
Reputation: 1583
Some of my URLs were crawled by Google with "index.php". I used the code below to redirect "bad" URLs to correct once, without index.php.
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
Upvotes: 2