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.

Loading PHP Pages Dynamically For On-page SEO

Discussion in 'PHP' started by Aceblackhat1, Apr 18, 2016.

  1. #1
    I am my second week into learning PHP & building database-driven dynamic websites.
    I noticed that some database-driven websites seem to load their pages from the database
    into the main "index.php" page. In terms of on-page SEO & link indexing, is this the best way
    to load the pages on your site & get them indexed by Google, Yahoo, Bing, etc., or should I
    create separate page files (e.g. Home.php, About.php, Contact.php, etc.) for each page of my
    website? Whichever is best in terms of SEO, I am willing to try it. Thanks.


    P.S.
    Oh, & the website that I'm building is an eCommerce website for my fiance. Would like for
    the users to be able to click on any product & then load the corresponding details page about
    the product either on that index page or on a separate page. Thanks again! :)
     
    Aceblackhat1, Apr 18, 2016 IP
  2. Anveto

    Anveto Well-Known Member

    Messages:
    697
    Likes Received:
    40
    Best Answers:
    19
    Trophy Points:
    195
    #2
    For an ecommerce site you would probably want to store the pages in the database as it would allow you to add more products easilly. Create a table with product name, description and a price for example. You may also want an url stored in the database which you could generate from the product name using something like this http://iamseanmurphy.com/creating-seo-friendly-urls-in-php-with-url-slug/ (someone created a function) or you could just type in the url structure manually.

    Then with .htaccess, you will need url rewrite turned on in apache, you would take the url yoursite.com/my-prodouct/ and convert it to yoursite.com/index.php?product=my-prodouct and then you would get the get variable with $_GET['product'] and query the database for that url slug or do some other kind of matching to maybe catch misspellings and whatnot, up to you.

    A simple guide here http://www.visualscope.com/seo-friendly-urls.html
     
    Anveto, Apr 18, 2016 IP
  3. fisasti

    fisasti Active Member

    Messages:
    42
    Likes Received:
    5
    Best Answers:
    2
    Trophy Points:
    58
    #3
    Hi Ace. Are you familiar with Apache's Mod Rewrite? You should check it out because there is one thing you need to understand.
    When you do a HTTP request to a web server, that webserver takes the requested url, processes it and then searches for the file the user is asking for. Let's see an example.
    You type mywebsite.com/test-page.php. Apache receives that, locates the folder with the files for the mywebsite.com site and takes the path, now "/test-page.php". What does mod_rewrite do? It allows you to put filters on the requests and make internal redirections so the website structure the users see is not the same as in the server.
    If you specify a location rule in your .htaccess file, you can redirect all the requests asking /test-page.php to index.php, in example.

    The conclusion: for SEO purposes, having one index.php file in your server and all the information stored in the database or having lots of different files, one for each product i.e., it's exactly the same. I would recommend you to redirect all the requests to index.php and then process it. If you see the requests url contains "/products/product-id" i.e., you search for the product in the database.

    Good luck!
     
    fisasti, Apr 18, 2016 IP
  4. zakariakhan

    zakariakhan Greenhorn

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    Yes PHP is for dynamic website but there is not fixed issue that will increase your on-page strategy for coding with dynamic website language as you mention PHP. You may fixed this seo by coding.
     
    zakariakhan, Apr 25, 2016 IP