Reputation: 23
I have added .htaccess file to my directory. When I am writing http://lootainment.in/koovs its working. But when I am writing http://lootainment.in/koovs/ its not working. My htaccess file code is following :-
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Upvotes: 0
Views: 52
Reputation: 786091
Make trailing slash optional in your rule and remove directory check condition:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.+?)/?$ $1.php
Upvotes: 2
Reputation: 25
At first check your php.ini settings for Server API if your server api is 1)apache, 2)apache2filter, 3)apache2handler or like then only you can use .htaccess file. In htaccess file if your php version is php5 then use <IfModule mod_rewrite.c> block to write this code
try this code
RewriteEngine On
# Remove .php-extension from url
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^\.]+)/$ $1.php
Upvotes: 0
Reputation: 7476
Try this,
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^\.|/]+)$ $1.php [NC,L]
Upvotes: 0