.htaccess Help

Discussion in 'PHP' started by FariZimal, Jan 22, 2013.

?

Which language is the best one ?

  1. PHP

    5 vote(s)
    100.0%
  2. ASP

    0 vote(s)
    0.0%
  1. #1
    Hi everyone ,
    i need some help please. I want to use .htaccess with php from CMS / Admin Panel. Basically, i want to masking the links like
    examples:
    php link: www.mysite.com/products.php?id=12
    i want to change/masking this link to like
    www.mysite.com/footballs.html

    Can anybody help me please how i can use .htaccess with php so i will be able to change the link from CMS / Admin Panel which i will make.

    Waiting to hear from PHP experts.

    Advance Thanks
     
    FariZimal, Jan 22, 2013 IP
  2. amit0535

    amit0535 Active Member

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    50
    #2
    
    RewriteEngine on
    RewriteRule ^(.+)\.html$ products.php?title=$1 [L,PT,QSA]
    Code (markup):
    This htaccess code will pass all URL ends with .html to your page products.php.You can get value "footballs" by $_GET['title']. Now its up to you how to find ID of your post by title.
     
    amit0535, Jan 22, 2013 IP
  3. alfonko

    alfonko Active Member

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    61
    #3
    there is a regular expression tester where you can type in one field your regular expression and then in the other field test if what it suppossed to be taken care by your regular expression is actually being taken care by being highlighted in yellow! do you know what i mean? i cant yet publish links but look for regexpal dot com and you should be good to go with your testing
     
    alfonko, Jan 22, 2013 IP