Note that there are some explanatory texts on larger screens.

plurals
  1. POImplementing friendly links into custom CMS
    text
    copied!<p>I am interested in making my website URLs friendlier for the eye (and Google) by implementing various directories rather than obscure ?id=xyz pages. Examples:</p> <pre><code> /review.php?id=371 </code></pre> <p>To </p> <pre><code> /review/deja-vu/ </code></pre> <p>And</p> <pre><code> /reviews.php?sort_by=1&amp;order=1&amp;approved=1 </code></pre> <p>To</p> <pre><code> /reviews/asc/by_title/approved/ </code></pre> <p>And so on..</p> <p>However, when googling the subject, it seems that there are a lot of hints, tips and optimal practice suggestions available on the internet, but very little in actual guides or tutorials on <em>how this is done fundamentally</em>. Bits and pieces I managed to pick up imply that .htaccess and HTTP redirects are key, however...</p> <ol> <li><p>I can't do a simple replacement since the article name isn't actually in the URL (an ID must somehow become the title string assigned to the article)</p></li> <li><p>I need my site to link to the 'prettified' URLs, so I also need a PHP/MySQL component to the system (unless .htaccess code magically replaces all existing links on pages with pretty versions?)</p></li> </ol> <p>Thus my question: <em>How are friendly URLs done?</em> My site uses PHP and calls its content from a MySQL database. Should I add a new MySQL table with two columns to translate specified URLs into shiny new ones, as in:</p> <pre><code> Column 1: review.php?id=371 Column 2: review/deja-vu/ </code></pre> <p>then replace all 'raw' hyperlinks on the pages with PHP using these values and use .htaccess magic to redirect? Maybe there's a better, more practical approach? Or maybe I'm entirely on the wrong track here?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload