Reputation: 13
I am very new to the MVC. I am trying to hide the index.php from the URL. I got an .htaccess file from our another team.
http://localhost/BusinessDatingApp/ When I enter the link above then the index controller is running fine which is a default controller.
When I enter this URL (http://localhost/BusinessDatingApp/city) it throws an error
"The requested URL /BusinessDatingApp/city was not found on this server.
Apache/2.4.7 (Ubuntu) Server at localhost Port 80"
Here is my .htaccess file.
#php_flag display_errors on
#php_value error_reporting 9999
RewriteEngine On
#RewriteCond %{HTTP} !=on
#RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# force url to lowercase
#RewriteCond %{REQUEST_URI} [A-Z]
# ensure it is not a file on the drive first
#RewriteCond %{REQUEST_FILENAME} !-s
#RewriteRule (.*) rewrite-strtolower.php?rewrite-strtolower-url=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
What I am missing here? Any help would be appreciated
Upvotes: 1
Views: 62
Reputation: 46
The .htaccess file is fine. But you need to give override permission to root directory . Because by default this permission is not given,
you need to enable re-write module in apache
I have followed this steps : https://askubuntu.com/questions/48362/how-to-enable-mod-rewrite-in-apache
Upvotes: 1