CodeIgniter Forums
Remove index.php from the URL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Remove index.php from the URL (/showthread.php?tid=61373)



Remove index.php from the URL - smallbug - 04-11-2015

While surfing through the Internet I saw many videos that show how to remove index.php from the URL.

Why should we do that? Only because of the beauty?

CodeIgniter has not already installed that from HOME if that is important and necessary?

By the way , despite the videos I haven't got it.


RE: Remove index.php from the URL - silentium - 04-12-2015

You normally do it to get nicer and more search friendly URLs on your website.

To remove the index.php file from your URL you need to
  1. Make sure your server has Apache mod_rewrite enabled
  2. Added needed .htaccess file in the root of your site (normally in the same location as the index.php file). Example code below.
  3. Removed 'index.php' from $config['index_page'] in the config file.

Example of code in your .htaccess file
Code:
<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

http://www.codeigniter.com/userguide3/general/urls.html#removing-the-index-php-file


RE: Remove index.php from the URL - alkarim - 04-16-2015

Removing index.php from the url will gives your site a better chance to get displayed while using search engines Smile


RE: Remove index.php from the URL - gadelat - 04-16-2015

No it won't, that's a myth.


RE: Remove index.php from the URL - alenn - 04-16-2015

(04-16-2015, 02:12 AM)gadelat Wrote: No it won't, that's a myth.
Removing "index.php" can shorten the URL length, and for the sake of cleaner/pretty URL.

Will removing index.php improve SEO of your site?
Found magento SEO article https://blog.udemy.com/magento-seo/ saying that removing index.php will improve the search ranking. How true is that?

I'll based on Google SEO guidelines as I use google search engine most of the time (99.99% of the time):
https://support.google.com/webmasters/answer/76329

So teh answer is YES! Removing index.php will improve your site SEO!
Whenever possible, shorten URLs by trimming unnecessary parameters.

Added SEO guidelines for reference:
http://static.googleusercontent.com/media/www.google.com/en//webmasters/docs/search-engine-optimization-starter-guide.pdf