www.webdeveloper.com
Results 1 to 2 of 2

Thread: .htaccess drop index.php

Hybrid View

  1. #1
    Join Date
    Jul 2012
    Posts
    1

    .htaccess drop index.php

    Hello,

    I am hoping someone can help me out! I've been trying to learn the inner-workings of how MVC frameworks are created (like Wordpress, CodeIgniter, Drupal, etc.) and have been doing an excellent job. However, it all looks so ugly to me because of my prominent issue of having an index.php page be in my domain. My website set-up is as so:

    http://localhost/mvc_test1/index.php/home

    What I would like it to display as is:

    http://localhost/mvc_test1/home

    I have written the .htaccess file but it still seems to produce no desired results, and was hoping somebody would be able to help. I do have mod_rewrite capability, if you were wondering.

    Code:
    <IfModule mod_rewrite.c>
            RewriteEngine On
    
            RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /index.php/$1 [L]
    
    </IfModule>
    http://localhost/mvc_test1/index.php/home still works with this in place, but http://localhost/mvc_test1/home just redirects to http://localhost/.

    Help?

    J

  2. #2
    Join Date
    Oct 2012
    Posts
    4
    Try

    Code:
    Options -Indexes
    DirectoryIndex index.php
    RewriteEngine on
    RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|js|robots\.txt|favicon\.ico)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
    Modified to your needs!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles