This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Getting rid of index.php?
#1

Hey I am really enjoying commentics, but i'm having a problem. My project is build with codeigniter and i'm using a custom .htaccess file, mainly to get rid of index.php.

Every time I want to login to the admin panel I must delete the .htaccess file.I tried adding the code you specified before but it doesn't really work.

Could you take a look at my .htaccess which is below and instruct me on how to proceed, once again thanks!

Code:
<IfModule mod_rewrite.c>


RewriteEngine On
RewriteBase /

# Redirect index.php and default controller (you need to edit this) to "/". This is to prevent duplicated
# Content. ( /welcome/index , index.php => /)
RewriteRule ^(welcome(/index)?|index(\.php)?)/?$ / [L,R=301]

# Remove /index/ segment on the URL.
RewriteRule ^(.*)/index/? $1 [L,R=301]



# Remove Trailing Slashes.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)(/+)$ $1 [L,R=301]


# Remove Multiple slashes in betweeen
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]

# Add the file SUFIX (sufix can be set on config.php).
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_URI} !\.html
# RewriteRule ^(.+)$ $1\.html [L,R=301]

# Remove any slash before .html ( to prevent site/.html )
# RewriteCond %{REQUEST_URI} \/+\.html$ [NC]
# RewriteRule ^(.+)\/+\.html$ $1\.html [L,R=301]

# Send everything to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>
Reply
#2

forgot to add this is code I added:

Code:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.myurl.com/ [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.php$ http://www.myurl.com/ [R=301,L]
Reply
#3

Hi,

I'm afraid I'm not familiar enough with .htaccess to provide a solution, however I did a Google search for "htaccess exclude directory" and I found a few good results.

http://www.webmasterworld.com/forum92/2455.htm
http://stackoverflow.com/questions/18485...write-rule
http://stackoverflow.com/questions/17157...min-folder

Hopefully these will help. If not, you may want to ask on somewhere like Stack Overflow.

Have you completed the interview?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)