Reputation:
My current urls look like this [mysite].com/index
I removed .php's with the following .htaccess code but i can not remove the index from the url.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
</IfModule>
How can i remove 'index' from the url?
EDIT
I found why it does not work because of windows hostings does not support htaccess method.
Upvotes: 2
Views: 68
Reputation: 7476
Use
DirectoryIndex index.php
Now apache will treat index.php as directory index and you don't have to type index or index.php in url bar.
Upvotes: 2
Reputation: 199
Actually, removing the page name for good it's not a good practice.
It may cause errors, and it's not good for SEO.
I strong suggest you to use friendly URL to remove the PHP extension(the way you're doing right now) or put some other name more friendly.
Exemple:
RewriteEngine On
RewriteRule ^home/?$ /my_new_index.php [NC,L]
RewriteRule ^new-order/?$ /new_order_from_client.php [NC,L]
It's the best practice!
Upvotes: 0