As part of a project, we re currently looking at adding in SEO URLs to pages. This is for an online store, and there are numerous types of content within the site: static pages (for example "About Us", "Privacy Policy", product categories and product pages.
We have the numerous URL stubs stored in a MySQL table as follows:
+-----------------+------------------+----------------+
| url_stub | destination type | destination_id |
+-----------------+------------------+----------------+
| privacy-policy/ | page | 1 |
+-----------------+------------------+----------------+
| category-1/ | category | 2 |
+-----------------+------------------+----------------+
| my-product-1/ | product | 1 |
+-----------------+------------------+----------------+
达到这一水平的一个选择是拥有巨大的指数。 然而,如果能够处理所有事项,我们更希望有单独的网页,以达到不同的内容类型。 例如,<代码>stination_type of page
的任何东西都将上页。 php?id=#,等等。 因此,以上表格中的例子如下:
privacy-policy/ = page.php?id=1
category-1/ = category.php?cat=2
my-product-1/ = product.php?prod=1
My question is this: what would be the best practice to achieve this? We don t want to include the destination_id
anywhere in the SEO-friendly URL. I was thinking that it might be possible to create a dynamic .htaccess file which outputs everything on the fly with mod_rewrite
, but I can t find any solutions.
Any help or comments would be most gratefully received.