Removing index.php using .htaccess


#1

I need to remove index.php from my URLs that read such as domain.com/index.php/site/login so they read domain.com/site/login.

I currently have .htaccess is my webroot directory (chmod 644) as follows:

[code]RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php[/code]

But nada! What am I doing wrong? I’m using a shared hosting plan, but I read that mod_rewrite is enabled on all plans.

Thanks!,
doughty


#2
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

#3

Still, same result. I’m using the yiiframework, which basically initially uses domain.com/index.php?r=controller/action, but with .htaccess, im supposed to be able to boil that down to domain.com/controller/action

so far, im getting domain.com/index.php/controller/action, which is still just a little too funky for my taste :confused:

Any other ideas?


#4

Keep in mind that .htaccess does not affect what your web application will generate for URLs in its output. It can only manipulate how those URLs are mapped to requests that your application will see.


#5

this is what I’m trying to follow along with: it’s a very short read about how to edit .htaccess.

I think dreamhost might not be allowing mod_rewrite on my account.


#6

Did you turn showScriptName off?

http://www.yiiframework.com/doc/api/1.1/CUrlManager