Jump to content

Need Help To Url Rewriting


mrj

Recommended Posts

Hello,

I've created a quotes db where I can save my own quotes :P. To make my quote page seo friendly, I need to rewrite "quotes.php?id=1" as "quotes/view/1.html" and "quotes.php?p=2" as "quotes/pages/1.html".

For 1st term I used following code in .htaccess:

#Options +FollowSymLinks

RewriteRule ^/quotes/([0-9]+).html$ /quotes.php?id=$1 [NC,L]

But unfortunately, it.didn't work. So I need help. Thanks in Advance.

Regards,

Meraj

Link to comment
Share on other sites

That re-writes to a file that doesnt exist thats why it doesnt work, you need to to go to quotes/view/1 not 1.html because its looks for the html file 1 in the directory /view/

 

 

 

RewriteRule ^blog/article/([A-Za-z0-9-\+]+)/?$ /index.php?Page=blogarticle&id=$1 [NC,L,QSA]

 

[NC] Means no case

[L] means last - dont check against other RewriteRules!

 

^quote/view/([A-Za-z0-9-\+]+)/?$ /index.php?Page=view&id=$1

 

$1 will pass the whatever comes after view/... or what is placed within ([A-Za-z0-9-\+]+) as a php variable id this means you can use php to load up the required page! For example, my website over at http://Bailey.cf uses only one index page but complex rewriterules to make it how it seems!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...