1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    kerala, India
    Rep Power


    Hi Friends,

    Please help me.
    How to write htaccess in mvc?

    My folder structure is listed below.

    admin (main folder).

    admin -> models,views,controllers

    I need to change pagename (www.example.com/admin/views/products.php) to www.example.com/category.php or www.example.com/category.

    Thanks & Regards
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Rep Power
    Um, why on earth would you want www.example.com/category to point to the admin category template? Shouldn't that be www.example.com/admin/category pointing to the controller of the category admin?

    Either way, it doesn't make a lot of sense to manually add every single rewrite to the .htaccess. What you want is a router script: Redirect every non-existent URL to a central script which takes care of instantiating the right controller:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . /main.php [L]
    The actual routing can be done with a framework like klein.php. Or you write that part yourself.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo