1

I am building a open blog website which users can create posts. Whenever a user creates post, it is being inserted to database and fetching its heading from database in the main page. Whenever a visitor clicks the heading of some post, it goes to a URL like

example.com?subject=places_to_visit_in_new_york

Also, today I generated a sitemap and it doesn't include those posts because they are not real pages and they are being called via a PHP function. I just sent my sitemap to Google and so far Google isn't indexing posts. (Which I understand.)

I checked other forums and their URLs are like

example.com/places_to_visit_in_new_york

Should my page be creating a new file for each post or can I keep going using a parameter for SEO?

If you tell me I can keep going this way, how can I understand if Google indexes posts? If a new file must be created for each post,can you tell me how to do it?

  • Interesting question that I'd be curious to see the answer to. With Wordpress, there's no physical file either, as everything is stored in the database. The sitemap points to files that are created on the fly from the database. However, the querystring does not appear in the sitemap, only the URL. I'm guessing (but don't know) that Google may ignore query strings. – Trebor May 3 at 13:40
  • "The sitemap points to files that are created on the fly from the database" .What do you mean by this and do wp use query strings for each post?If they do,we can do it either cauae I believe they are doing the right way.But because I am unfamiliar with wp,I will appriciate if you can tell me their system – dudi May 3 at 14:39
1

The url example.com/places_to_visit_in_new_york can be created dynamically depending on the framework/language your website is based on. This means that you don't have to create separate files for seperate urls just like using the query string format.

Consider the example of Wordpress where you have the option of choosing between multiple url patterns under the permalinks section

  1. example.com/posts?id=1
  2. example.com/my-new-post

The most preferred format is the second one

The reason can be understood by reading this article Keep a simple URL structure

A site's URL structure should be as simple as possible. Consider organizing your content so that URLs are constructed logically and in a manner that is most intelligible to humans (when possible, readable words rather than long ID numbers). For example, if you're searching for information about aviation, a URL like http://en.wikipedia.org/wiki/Aviation will help you decide whether to click that link. A URL like http://www.example.com/index.php?id_sezione=360&sid=3a5ebc944f41daa6f849f730f1, is much less appealing to users.

However query strings in url are also common when it comes to filtering your content or pagination. But keep in mind that Google crawls and indexes content on both url formats unless there is content duplication or some other issue.

  • Thank you so much.To be sure,Google will index my content while I fetch it from database even tough sitemap doesnt include each post,right?In this case,I will rewrite slash instead of question mark in .htaccess and keep on going... – dudi May 3 at 17:42
  • Google will crawl and index these pages if it finds a link for that page on other pages. Sitemap is just an indication for Google that these pages are to be crawled. Google does not limit its crawling to only the sitemap. It discovers more links as it crawls other pages – Shahzeb Qureshi May 4 at 0:40
1

No one can know for sure how your HTML documents are delivered (unless they have backend access to your server).

The URL can give a hint, but there is no guarantee that this hint is accurate. /foobar.php and /foo?bar could retrieve static files, /foobar.html and /foobar could retrieve dynamically generated files. But even if a search engine would know, it doesn’t matter: what counts is the document, not how it’s generated.

URLs: Search engines can crawl/index URLs with mandatory query components perfectly fine. The primary reason to prefer path-based URLs is that they might be more user-friendly/beautiful.

Sitemap: If you have a sitemap, and if you want the blog posts to get indexed, there is no reason not to add them to the sitemap.

0

The path portion of the URL always refers to a unique page/post in WP. When a user requests http://example.com/my_post, WP matches the path to a unique database ID and then creates the file on the fly similar to what you are doing. However, as others have mentioned, a querystring/parameter is not user friendly.

The WP sitemap can be both a Google and user friendly URL/path for each post and hide the actual querystring from both Google and users.

Not a criticism, but simply wondering... If you are trying to write a new page using MySQL data, why not use something like WordPress or Drupal that already has lots of testing, rather than reinvent the wheel?

  • Because it was harder to use WP for my project which I designed very specific.I dont know if we are allowed to share links but here it is sosyosapien.com .By the way,I dont mean just the URL structure,I mean is it possible for google to index contents which are being displayed via database and there is no file for each one...(All the posts are being displayed in index.php) – dudi May 3 at 18:32
-1

With dynamic URLs using query parameters you are not creating any unique page. Google mostly threats those URLs as It was the same adress with just some parameter. If you really want to index those pages and there is a unique content on thm, then use static URLs like in your second example and also optimise the content, headers, title, descriptions etc.

  • While its a website users can create posts and it may contain huge amount of posts,is there a way of creating new file out of each row of my mysql table?For example,do stackoverflow kind of massive sites create new file for each question user asks or can they be using .htaccess to rewrite "/" instead of "?" ? – dudi May 3 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.