In a new project, a website has a set of static html pages. The owner needs to convert them to dynamic ones.
Each page has: a text section, a small photo plus some links towards other pages, related to this one.
All these i can put in database and create a dynamic page (php).
My problem is that each static page is unique - no common pattern in url. And there 860 such pages at the moment.
I can have one url like:
folder1/folder2/item1.htm
folder1/folder2/folder3/item2.htm
folder1/folder2/folder2-fodler3/item3.htm
These 3 are the most common patterns so far (serving around 650 urls out of the 860).
Each folder name is actually a category/subcategory/keyword i can use to determine the properties of my item. As a general rule, the first 2 folders (folder1 and folder2) are the category and subcategory of the product, while the next folders (folder 3 and after that) determines the section (if any) of the item.
I hope this makes sense.
So, one thought is to use the old, static, url as a database filed and match this to serve the content, something like:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /script.php?path=$1 [L]
I think that putting this rule at the very end of my rewrite rules will ensure that all other rewrites are unaffected.
Is this approach advisable? OR is there another way? Something more robust/secure/light?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…