Reputation: 8705
I've managed to remove the need for typing index.php
in my urls, but it is still possible to do so. I don't want that and want to prevent users to be able to access my application via urls like /index.php/home
or /index.php/contact
or even /index.php
.
Does anyone know how to accomplish this?
Upvotes: 0
Views: 791
Reputation: 3493
If you're using Apache, then just setup a rewrite rule to redirect users from index.php to /
RewriteRule ^/index\.php$ /
RewriteRule ^/index\.php/(.*) /$1
Upvotes: 0
Reputation: 1309
Exactly. Here's an example:
RewriteRule ^foo\.html$ bar.html
Or you can use variables like so:
^hotsheet/(.*)$ http://www.tstimpreso.com/hotsheet/$1
Upvotes: 0
Reputation: 7804
In you .htaccess
write in the top
DirectoryIndex my_new_index.php
RewriteEngine on
RewriteCond $1 !^(my_new_index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /my_new_index.php/$1 [L]
Rename your index.php
file to my_new_index.php
Upvotes: 1