Jump to content

Recommended Posts

Hello All,

 

I have been trying to grasp this concept for a while, but no one has been able to explain it to me. I am currently developing a website and part of that website is a home brewed blog system. The blog build has been pretty fun, but the concept I have been trying to grasp is when it comes to blog posts generated by php, hmtl and xml. One be ball of coding fun.

 

The way I have my blog built is on the backend the admin fills in all the information, title, author, blog entry, etc. Then that information is store in a database via a form POST script. On the blog front page the visitor will click the story link and all the information is pulled from the database based on an idea number automatically given to that blog post when it is posted to the database from the backend.

 

Now the idea is how do I make those articles search engine friendly. I talked to some SEO experts and they told me that search engine crawlers prefer html, but I cant create all those pages without php.

 

My idea is to ask is there anyway to create html pages with php and store them in a folder?

 

Is there another method I am missing??

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/268457-grasping-a-concept/
Share on other sites

The part you are likely missing is a mod for apache called mod_rewrite. This allows your server to process requests for non existent pages as though they actually existed.

 

eg; A url like: /some-article.html can be processed by your blog.php file and you can have the "some-article" part passed in as a parameter allowing you to do a database lookup by article title.

 

A simple rule for this might look something like:

 

RewriteRule ^([^.]+)\.html$ blog.php?article=$1

 

Then, in blog.php you will have $_GET['article'] which will contain the string "some-article" (given the above example).

Link to comment
https://forums.phpfreaks.com/topic/268457-grasping-a-concept/#findComment-1378526
Share on other sites

Right! I have seen this before, but my greatest concern in this conversation is SEO and a site map when it comes to php stored articles in a database.

 

In an xml sitemap it is best if you have each page posted on your sitemap.

 

So, I guess my question is, is there a way to post to a site map everything you create a new story?

Link to comment
https://forums.phpfreaks.com/topic/268457-grasping-a-concept/#findComment-1378527
Share on other sites

I talked to some SEO experts and they told me that search engine crawlers prefer html, but I cant create all those pages without php.

 

ROFLMAO. PHP is just fine. You send HTML to the browser, so search engines will also read that HTML not your PHP script. Like thorpe mentioned you need mod_rewrite to create rewrite rules so special URL's are re-routed:

 

http://somedomain.top/blog/foo-bar-was-here/

 

Which is then redirected to your script where you resolve foo-bar-was-here to an actual row in your database and display that information.

Link to comment
https://forums.phpfreaks.com/topic/268457-grasping-a-concept/#findComment-1378529
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.