php - How to define friendly URL rules using .htaccess? -


long time trying define rewriting rules not succeed yet? have simple page http://www.myurl.com/pdf.php?id=2. want make friendly this: http://www.myurl.com/pdf/2/ ...

i wrote rule after spending time on google:

options +followsymlinks rewriteengine on rewriterule ^pdf/([0-9]+)\$ pdf.php?id=$1.  

when uploaded .htaccess file on server , try run first give me 500 error. second time loaded page not show me friendly url; showing before. kindly tell me better solution, followed many instructions make useful not successful. client not going further unless showed him friendly url. kindly me possible. client hosting organization: justhost.com.

you can using apache's rewrite engine. this:

rewriteengine on rewriterule ^pdf/([0-9/]+)$ /pdf.php?id=$1 [l] 

this allow go http://yoursite.com/pdf/192 instead of http://yoursite.com/pdf.php?id=192


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -