in htacesss file in admin folder, removed php extension on wamp although worked fine. when moved to ubuntu with lamp server. it's giving 404 not found. but htaccess working perfectly for other thing like index routing.Below what i am using on htaccess file.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
DirectoryIndex index.php
Try this rule:-
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
OR
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]
OR
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
If this global rules is not working for you then try below code also:-
In this code replace 'work' with your project root directory.
RewriteEngine on
RewriteBase /work/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !\.php$
RewriteRule .* $0.php [L]
In linux you need to ON rewrite module.
open your terminal(ctrl+alt+t) and run this command.
sudo a2enmod rewrite
then restart apache2 by this command:-
sudo service apache2 restart
This tutorial link will help you.
Hope it will work for you :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With