Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts

    Question difference between .htaccess and router

    Hi

    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?

    Thanks

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    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.

  • Users who have thanked Keleth for this post:

    phantom007 (07-20-2012)

  • #3
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts
    Excellent explanation Keleth.

    Many thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •