Hi all,

I have a site that has a dynamically generated page and looks like this:


The page has the article title and description stored in a database and printed in the page itself.

How do I go about changing the URL from this:


To this:


where the article description is stored in a database?

Thanks in advance.

Your links all give 404 errors.

Are you wanting to link to the page via method one, but have the url show in the window as the second example?

I know, the links above use the url www.example.com just for the sake of this thread.

The website currently has urls like this:


and I want to use .htaccess and apache's mod_rewrite to get information from the sites database and put that information in the url.

Let's say the article with primary key aid=3 (as shown in the url above) has the title "how to fix a laptop" in the database. I want to get that title from the database and re-write the url from what is above to the following:


I may be confusing this with another question, I thought I saw that you didn't want to use a hash file but that looks like it would be the way to go.

Use PHP to generate the hash file from the database and create RewriteRules to match them up.

$artinfo=popquery("select * from articles"); //popquery isn't a real function
for (i$=0;$i<$numarts;$i++)
 $rulestring="RewriteRule ^/articles/$title /article.php?aid=$aid";

Something like that, maybe?

I think this is beyond my current knowledge base. ;)

Hey, sorry for the super late reply but iv been really busy.

In the end I just started over with the articles part of the site and am now using wordpress to manage all my articles and am using it's permalink function to get search-engine-friendly urls.



I made a custom theme and integrated it into my site design, was actually very easy, for anybody elses reference theres a great tutorial here:


Thanks for your help, i might need this later anyway :)