Url Rewriting Problem

Discussion in 'PHP' started by hope2life, Mar 7, 2010.

  1. #1
    Hi,
    I need some url rewriting help. My site is in php and uses mysql database to retrieve content on site pages.

    destination url is top/b_services.php
    pattern is info/b_services_information.htm

    How can I rewrite ?

    I mean to ask if info/b_services_information.htm is called in the browser it should display content from top/b_services.php

    any help would be greatly appreciated.
     
    hope2life, Mar 7, 2010 IP
  2. n3r0x

    n3r0x Well-Known Member

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    120
    #2
    Something like this should work:


    
    RewriteEngine on
    RewriteBase /
    RewriteRule ^info/([a-zA-Z_]+)_information.htm$ top/$1.php [NC,L]
    
    Code (markup):
     
    n3r0x, Mar 7, 2010 IP
  3. hope2life

    hope2life Active Member

    Messages:
    1,641
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Sorry this code didnt work.
     
    hope2life, Mar 7, 2010 IP
  4. ChaibiAlaa

    ChaibiAlaa Peon

    Messages:
    190
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The code has to be putted on a .htaccess named file and uploaded to your server, not on your PHP File !
     
    ChaibiAlaa, Mar 7, 2010 IP
  5. hope2life

    hope2life Active Member

    Messages:
    1,641
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    90
    #5
    Yes I have putted the code in .htaccess file only and uploaded. But still it didnt work.
     
    hope2life, Mar 7, 2010 IP