Assume that I have the project folder:
folder / model folder / view folder / Control folder / public folder / library We now say that the site folder is folder / public / and inside that folder index.php < / Code>. For example, this file is GET parameter index.php? Page = user handles all site page requests via user.php file will apply to any other folder. The issue is that I like the URL like: www.site.com/index.php?page=user&id=1
www.site.com/user/id/1 How can I do this?
It is derived from .htacess rewrite rule:
Lt; IfModule mod_rewrite.c & gt; % {REQUEST_FILENAME} on RewriteEngine RewriteCond! -d Recovery code% {REQUEST_FILENAME}! -f Rewrite rules ^ (. *) $ Index.php? Url = $ 1 [QSA, L] & lt; / IfModule & gt; This will render everything under your host - - & gt; *
From here your index.php $ _GET ['url']
// can parse browser requests for example www.site.com/user / Id / 1 $ Url = $ _GET ['url']; // user / id / 1 $ params = explosion ("/", $ url); // array (0 = & gt; "user", 1 = & gt; "id", 2 = & gt; "1")
Comments
Post a Comment