That .htaccess rule you’re using doesn’t have anything to do with a URL redirect; all it does is process a request with index.php if the request isn’t for a file or a directory; see my comments below:
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] #If not ending in gif, jpg, jpeg, or png
RewriteCond %{REQUEST_FILENAME} !-f # If not a file
RewriteCond %{REQUEST_FILENAME} !-d # If not a directory
RewriteRule ^(.*)$ /index.php/$1 [L] # Process request with index.php
You want something like this (which also kills the www subdomain, if that’s something you’re interested in):
# ---------------------------------------------------------------------
# Enable Rewrite Engine
# Use RewriteBase to define path to base of EE install, e.g. /development/project-name/, if not in root of domain
# ---------------------------------------------------------------------
RewriteEngine on
RewriteBase /
# ---------------------------------------------------------------------
# Kill www subdomain
# Example: <a href="http://www.example.com/foo/">http://www.example.com/foo/</a> -> <a href="http://example.com/foo/">http://example.com/foo/</a>
# Doesn't apply to https URLs
# ---------------------------------------------------------------------
RewriteCond %{HTTPS} !=on
RewriteCond %{THE_REQUEST} ^GET [NC]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# ---------------------------------------------------------------------
# In any request contains "index.php" ...
# ... and is an Apache GET request ....
# Then ...
# ... redirect to the requested location without "index.php"
# ---------------------------------------------------------------------
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) $1$2 [R=301,L]
# ---------------------------------------------------------------------
# This rule is needed if query string is given to homepage w/o template name in URI, e.g. example.com instead of example.com/default_template_group_name
# Note: you must may have to change the name of the default template group in this rule to match your setup
#
# If any request request that is not at least 1 char long ...
# ... and contains any sort of query string 1 or more chars in length ...
# ... and doesn't contain a query string of "css=" or "URL=" or "ACT=" ...
# Then ...
# ... process it with /index.php?/[defult template group]/[request]
# ---------------------------------------------------------------------
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteCond %{QUERY_STRING} !(css|URL|ACT)=
RewriteRule !^(.+)$ index.php?/site/$1 [L]
# ---------------------------------------------------------------------
# This rule is needed to handle query strings in EE
#
# If entire any request ...
# ... doesn't contain an image, css, or js extension, ...
# ... and isn't a file name ...
# ... and isn't a directory name ...
# ... and contains any sort of query string 1 or more chars in length ...
# Then ...
# ... process it with /index.php?/[request]
# ---------------------------------------------------------------------
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^(.*)$ index.php?/$1 [L]
# ---------------------------------------------------------------------
# If entire request ...
# ... doesn't contain an image, css, or js extension, ...
# ... and isn't a file name ...
# ... and isn't a directory name ...
# Then ...
# ... process it with /index.php/
# ---------------------------------------------------------------------
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]