Here's what I want to do: I'm using CodeIgniter, so all URLs are in the form of http://example.com/index.php/controller/function
. However, the script I've written is a essentially a glorified link shortener with some built-in statistics functions, so I want all of the URLs to be in the form of http://example.com/link
. However, I would also like the script's admin panel to be available at http://example.com/admin/
. I adapted the CodeIgniter "remove index.php from URLs" example .htaccess to fit my situation, and it works correctly on my localhost (EasyPHP 5.3.9), but when I upload it to the production server (HostGator), all of the requests for the administration panel are being handled like a regular link and passed to the link controller (index.php/redirection/link
) instead of the admin controller (index.php/admin
). Here's my .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ index.php/$1 [L]
# When your application folder isn't in the system folder
# This snippet prevents user access to the application folder
# Submitted by: Fabdrol
# Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ index.php/$1 [L]
# Checks to see if the user is attempting to access the administration panel,
# and if so sends the request to the admin controller
RewriteRule ^admin/?$ index.php/admin/ [L]
RewriteRule ^admin/([^.]+)/?$ index.php/admin/$1 [L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to the redirect controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/redirection/link/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
Is there something I'm doing wrong? Any help or suggestions would be appreciated!