Some help on rewrite rule...

Discussion in 'Apache' started by braca86, Dec 25, 2012.

  1. #1
    Does anyone know how to rewrite something like

    /index.php?option=com_k2&view=item&id=30:name-of-itemto

    /index.php/name-of-itemor maybe

    /index.php/blog/name-of-item
     
    braca86, Dec 25, 2012 IP
  2. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,983
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #2
    Well, "30:" is part of the ID, so it's not as simple as you want. You need an internal system that will translate "name-of-item" to "30:name-of-item". Drupal does something like this very easily. I don't know what CMS you're using, but it seems very unfriendly for URL rewriting. Anyway, this should do the trick:

    RewriteEngine On
    RewriteRule ^index\.php/([^/]*)$ /index.php?option=com_k2&view=item&id=$1 [L]
    Code (markup):
    It will work with:

    http://domain.com/index.php/30:name-of-item
    Code (markup):
     
    ryan_uk, Jan 3, 2013 IP