View Full Version : difference between .htaccess and router
07-20-2012, 06:15 PM
Can someone please explain me how is the working of an .htaccess file different from that of a router of an MVC framework?
I think they both handle the incoming request and if that is so why use both and not any of one of them?
07-20-2012, 06:20 PM
They are two ENTIRELY different things.
.htaccess is a file read by the Apache server meant just to do site configuration, from the server side... so if you want to direct all traffic to a "Site under construction" page while you work on updates, you'd use an .htaccess if you wanted.
A MVC router takes incoming traffic, processes it, determines what it means, and feeds out the appropriate response. It requires the server to send it all traffic, mostly through the use of .htaccess (if you're on an Apache server). Its designed for logic, to figure out what URL means, whereas the .htaccess couldn't care less what the URL means, just what it says.
07-21-2012, 06:26 AM
Excellent explanation Keleth.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.