I have implemented my small website on a live server, however I want to use url-rewrite for some links to make it clean. I try this on my localhost server:
http://localhost/cb/2/login.php
to http://localhost/cb/2/login
I manage to make it work on my localhost server by editing the httpd.conf
of apache and enable url-rewrite. Here's the rule I added to apache:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/cb/2/login$ /cb/2/login.php
</IfModule>
However, when I upload my files to a live server, obviously I do not have privilege to edit httpd.conf
of that server, so I just put my rewrite rule on .htaccess
file and here's the content of it:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/login$ /login.php [L,QSA,NC]
But when I try to test it, 404 not found
is the response of server. I also try to implement in on my localhost server assuming I cannot edit the apache config and same error occurs, Object not found!
I have no idea what will I do next. I'm new to this url rewrite rule so any help will be much appreciated :)