How to create this type websites?

Dexter Morgan

Member
Feb 10, 2012
726
21
0
මචං ඔයා කියන්න් එතකොට මේක කරන්නේ .htaccess වලින් කියලද? :)

මේ සයිට් එක බලන්න http://srilankantravelhub.com/

methana .htaccess mukuth karala naha,meke php scripts thiyenne wenama directory ekaka,mhtml page eken script ekata call karala thiyenne,thawa jquery use karalath thiyenawa

sT7Vq3t9.jpg
 

GT9

Well-known member
  • Jun 22, 2013
    1,564
    167
    63
    [email protected]
    ඒක ලේසියි ඔතන තියෙන්නේ පොඩි දෙයක්, Apache server එක සාමාන්‍යයෙන් .html page එකක php code ගැහුවට execute කරන්නේ නෑ මොකද server එක valid extension එකක් හැටියට සලකන්නේ php ඉතින් අපිට server එකට වෙනමම කියන්න ඕනේ html,htm file වල තියෙන php code පවා execute කරන්න කියලා ඊට පස්සේ html file අස්සේ php code ගහනවා ඊට පස්සේ server එකෙන් html files process කරනවා කරලා ඒ අස්සේ php code තියෙනවා නම් ඒවා execute කරනවා.

    කරන්න තියෙන්නේ මෙච්චරයි server එකට ගිහින් root file එකේ තියෙන
    .htaccess file එක open කරලා මේ line එක add කරන්න


    AddType application/x-httpd-php .htm .html

    මේකේ වාසිය තමයි server එක use කරන Server Side scripting language එක clients ලාගෙන් hide කරගන්න පුලුවන් එතකොට hacking attack
    minimum කරගන්න ලේසියි.

    තෑන්ක්ස් අයියා. හැබැයි මෙතනදී .php ගහල .html පේජස් ඇක්සස් කරන්න හැදුවොත් .php වලිනුත් පේජස් තියෙන්න පෙන්නන්න ඕන නේද? ඔය අයියා දාල තියෙන .htaccess code එකට අනුව :)
     

    GT9

    Well-known member
  • Jun 22, 2013
    1,564
    167
    63
    [email protected]
    methana .htaccess mukuth karala naha,meke php scripts thiyenne wenama directory ekaka,mhtml page eken script ekata call karala thiyenne,thawa jquery use karalath thiyenawa

    sT7Vq3t9.jpg

    මචං තෑන්ක්ස්. හොසට් කරපු සයිට් එකක් නැද්ද පොඩ්ඩක් බලන්? ඔයා කියන දේ මට මීටර් වෙන්නෑ. :( .html files ඇතුලේ තියෙන php codes වැඩකරන විදියට සර්වර් එක හදාගන්න මම තාම දන්නෑ මම කවදාවත් කරල නෑ. :no: පොඩ්ඩක් මම මේ ගැන හොයල බලන්නම් තෑන්ක්ස් රිප්ලයි එකට. :)
     

    nismok

    Well-known member
  • Jun 27, 2008
    9,391
    673
    113
    IMO, putting .html extension on pages are useless (unless you need to hide underlying technology). It is better to have user friendly URL routing.

    Ex-

    example.com/about
    example.com/contact
    .. etc
     

    Fox Mulder89

    Well-known member
  • Dec 31, 2012
    2,460
    942
    113
    gampaha
    <?php
    // Connect to the DB Connect Class - Singleton Design Pattern
    include 'dbconfig.php';

    //Get the request URL and retrieve the Controller and Action
    $requestUrl = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    $urlParams = explode('/', $requestUrl);

    // Here you should probably gather the rest as params

    //Call the model
    try
    {
    $modelName = $urlParams[4].'Model';
    require_once 'Model/'.$modelName.'.php';
    }
    catch (Exception $ex)
    {
    echo "Cannot access the model class!";
    }

    //Call the controller and action
    try
    {
    $controllerName = strtolower($urlParams[4]).'Controller';
    $action = explode("?", $urlParams[5]);
    $actionName = $action[0].'Action';
    require_once 'Controller/'.$controllerName.'.php';
    // Call the action
    $controller = new $controllerName;
    $controller->$actionName();
    }
    catch (Exception $ex)
    {
    echo "Cannot access the controller class!";
    }

    //Include the View
    try
    {
    include 'View/'.$urlParams[4].'/'.$action[0].'.php';
    }
    catch (Exception $ex)
    {
    include 'View/index.php';
    }
    ?>


    this is coding for what you have ask
     

    Arkham Knight

    Member
    Mar 14, 2014
    1,627
    89
    0
    තෑන්ක්ස් අයියා. හැබැයි මෙතනදී .php ගහල .html පේජස් ඇක්සස් කරන්න හැදුවොත් .php වලිනුත් පේජස් තියෙන්න පෙන්නන්න ඕන නේද? ඔය අයියා දාල තියෙන .htaccess code එකට අනුව :)

    .php Extension files process වෙන එක block කරන්න :)

    ඒකට මම දන්න හැටියට මේ directive එක use කරන්න පුලුවන්.

    <files *.php>
    deny from all
    </files>

    ගහලා බලලා මට කියන්න
     

    rskoora

    Well-known member
  • Apr 1, 2008
    4,001
    608
    113
    search engine friendly wenna ban oka danne.

    ex:http://www.elakiri.com/forum/showthread.php?t=1609854

    dan oya wage url ekak patha digai. oya wage "?,=" kali walata google eken wadiya salakanne nalu.

    mata pena widiyata php extenstion 1 hanganna hetuwak na podi site wala awa html pages wenna ati.. nathnam simple template lang akak use karanawa ati ex - smarty wage .. .hugak podi site ada kale hadane CMS walin ne itin mea CMS support karanawa URL rewriting lesiyenma daganna puluwanm

    1 ma reason 1 SEO friendly wena aka tamay itin..
     

    kevindareal

    Well-known member
  • Apr 19, 2011
    4,176
    1,614
    113
    mata pena widiyata php extenstion 1 hanganna hetuwak na podi site wala awa html pages wenna ati.. nathnam simple template lang akak use karanawa ati ex - smarty wage .. .hugak podi site ada kale hadane CMS walin ne itin mea CMS support karanawa URL rewriting lesiyenma daganna puluwanm

    1 ma reason 1 SEO friendly wena aka tamay itin..

    yaya. ee kale math site ehema hadapu kale scripts wala URL rewriting walata convert karaganna amara namak nawe. dan ithin owa gemak nane. ee kale balan innakota traffic naginne. ekata dan :no: