Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder d'Anconia's Avatar
    Join Date
    Jan 2010
    Location
    Tempe, AZ
    Posts
    149
    Thanks
    16
    Thanked 6 Times in 6 Posts

    Written HTML or Variables (PHP)?

    I am trying to set up a website that would have a database full of companies and related information (ie name, country, website, description, etc), with the related information submitted to a database and stored.

    I think there are two major options that I have for the individual pages that will represent each company:

    1.) When the entity is first submitted by a user, use file_put_contents() to create a new web page for that entity. Insert the current variables (at that time) into the code for that webpage. This way there will be a webpage that is readable by crawlers for SEO purposes... I want to make sure that the individual entity pages will show up on Google and other search engines.

    The problem with this method is that it will be more difficult to have the user dynamically make a change to the entity's related info. It would still be possible but I would have to use PHP to let them re-submit the information and then replace the old information in the HTML with the new information (as well as updating those variables within the MySQL database).

    2.) Have a template already set up and when a new entity is submitted by a user, only submit the variables to a MySQL database and when a user wants to view the page for that entity, insert the variables into the webpage for the entity.

    The problem with this method is that I believe it may cause problems for rankings when it comes to Search Engine Optimization. Entity name, country, website, and description are just a few very *necessary* variables that I can think of and there will be plenty more BUT I have read that having more than 3 PHP variables causes your page ranking to go down. Plus how would a search engine crawl a dynamically-created webpage? Does it have access to the MySQL database variables or would it enter that page by continuing from a preceding href link?

    Am I totally thinking about this the wrong way? How do very popular sites like Wikipedia, Amazon, and IMDb apparently have so many pages that can still be indexed by search engines? I notice that Wikipedia and IMDb tend not to have *file names* at at the end of the URL's for the individual pages (articles and movies / individuals), so what method do you believe they use? Would a comparable method even be reasonable for a smaller website looking to eventually scale up (god willing)?
    Datagonia Web (My Portfolio)

    Powerful ideas for all lovers of personal and political freedom:
    Freedomain Radio
    Free Talk Live

  • #2
    Regular Coder
    Join Date
    Jan 2012
    Posts
    271
    Thanks
    2
    Thanked 65 Times in 65 Posts
    IMO creating the physical files for each user is the wrong way, the only way you should do this is by utilising a database to store the detail and generating pages dynamically.

    For SEO purposes you need to make use of a .htaccess file and http rewrite rules

    Wordpress does this very well, a typical WP htaccess file:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    Essentially you have a single index.php file that all requests are redirected to by the htaccess file and it handles the database requests and delivers data to the browser

    Eg; www.mydomain.com/this-business/

    The htaccess file will rewrite the traffic to the index.php page and include a get variable with the value 'this-business' you then get the data from the db for the slug 'this-business' and dynamically display the page

    research how wordpress does it and you'll find the best way IMHO

  • #3
    Regular Coder d'Anconia's Avatar
    Join Date
    Jan 2010
    Location
    Tempe, AZ
    Posts
    149
    Thanks
    16
    Thanked 6 Times in 6 Posts
    Thank you, I will take a look into it. I'm not as familiar with HTAccess but I'll read up on it.
    Datagonia Web (My Portfolio)

    Powerful ideas for all lovers of personal and political freedom:
    Freedomain Radio
    Free Talk Live


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •