rtacconi
rtacconi

Reputation: 14769

Remove .php with mod_rewrite

How can I change this url: http://localhost/index.php/Department/2

to this one: http://localhost/index/Department/2

Thanks.

Upvotes: 2

Views: 741

Answers (1)

Gumbo
Gumbo

Reputation: 655229

Try this rule:

RewriteRule ^index/(.*) index.php/$1

And if you want to strip the index/ too, try this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !^index\.php$ index.php%{REQUEST_URI}

Upvotes: 6

Related Questions