1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Html or php

Discussion in 'HTML & Website Design' started by drcensor, Aug 14, 2012.

  1. #1
    I've got a website that as about 6000 hits a month so don't want to hurt it in any way, but I want to make the header and footer into php files but not turn the rest of the page php, because I don't want to lose all the links to them, will that be seen as bad code by the search engines?
     
    drcensor, Aug 14, 2012 IP
  2. dieout

    dieout Active Member

    Messages:
    43
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    91
    #2
    You should research how to create .htaccess file. You can use old url with .htaccess and have footer and header with php codes.
     
    dieout, Aug 14, 2012 IP
  3. creativewebmaster

    creativewebmaster Active Member

    Messages:
    654
    Likes Received:
    7
    Best Answers:
    4
    Trophy Points:
    78
    #3
    .htaccess file to you can do using PHP code.
     
    creativewebmaster, Aug 14, 2012 IP
  4. SoftCloud

    SoftCloud Well-Known Member

    Messages:
    1,060
    Likes Received:
    28
    Best Answers:
    2
    Trophy Points:
    120
    #4
    Search engines cannot see any PHP coding, so Google (for example) won't know if you're using a header.php file or a footer.php file. Search engines only see the final output of a website.

    As was said above, use a .htaccess file to treat your .HTML files as .PHP (whilst still keeping the .HTML extension). A quick search would bring up how to do this. :)
     
    SoftCloud, Aug 15, 2012 IP
  5. xtech

    xtech Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The module is rewrite_mod and the process is called URL Rewriting. It's a bit involved and tricky task. Maybe you'll need to hire someone to do it. I would recommend using a MySQL table to store what must be served when what is asked.
    Here is the code I used in a project I built:
    This goes into .htacess:
    RewriteEngine on
    RewriteRule !(^.{0,}\.[a-zA-Z0-9\.]{1,4}$|^$) url_router.php
    
    Code (markup):
    And this goes into the url router:
    <?php
    require_once("init.php");
    if(isset($_GET['no_route']))
    {
        $url_router_file=$_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];
        $url_router_file=strstr($url_router_file,"?",true);
        include("mime_type.php");
        header("Content-type: ".get_mime_type(pathinfo($url_router_file,PATHINFO_EXTENSION)));
        readfile($url_router_file);
        exit();
    }
    $url_router_uri = str_replace(BASE_URL_RELATIVE,'',$_SERVER['REQUEST_URI']);
    if(strpos($url_router_uri,"?"))$url_router_uri=strstr($url_router_uri,"?",true);
    $url_router_hooks=array();
    execute_action("pretty_link",array(&$url_router_hooks));//array of array("pattern","file_to_be_executed")
    $url_router_hook="";
    foreach($url_router_hooks as $hook)
    {
        if(preg_match($hook[0],$url_router_uri))
        {
            $url_router_hook=$hook[1];
            break;
        }    
    }
    if($url_router_hook!="")
        include($url_router_hook);
    else
    {
        include("errors.php");
    }
    ?>
    Code (markup):
    As you might see, the php code has loads of dependencies which are defined in the init.php of my project. I won't be able to post it here as the project is not open source. If you want me to help you with it for a fee, PM or mail at technofreak777[at]gmail.com
     
    Last edited: Aug 15, 2012
    xtech, Aug 15, 2012 IP
  6. bluebelt91

    bluebelt91 Well-Known Member

    Messages:
    879
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #6
    I totally agreed with you.The search engine actually see final output of the site.
    Even if you code server side scripting , the final output of html or php file actually dooes matter for search engine.
     
    bluebelt91, Aug 15, 2012 IP
  7. Nuklez16

    Nuklez16 Greenhorn

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #7
    I would just recreate the whole site into php to get more visits
     
    Nuklez16, Aug 17, 2012 IP