URL Rewrite without using .htaccess

Discussion in 'PHP' started by binay00713, Mar 16, 2012.

  1. #1
    Hello everyone,How can i change the url when I am navigating from one page to another.


    for example if the existing url is like "www.example.com/product.php?name=xyz&q=service" ,I want to change it to "www.example.com/product/name/xyz/q/service"


    But I dont want to use .htacces. How can I do it using php functions only?
     
    binay00713, Mar 16, 2012 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    You need to be able to do some sort of rewriting to force all requests through a single file. From there, you can use php as a controller however you like.

    The problem with "/product/name/xyz/q/service" is that is would be interpreted as directories and a file without an extension. a rewrite would be required to prevent this from happening.
     
    jestep, Mar 16, 2012 IP
  3. Ultrabooked

    Ultrabooked Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think you can't do it (correct me if I'm wrong). The web server is responsible for the rewrites and the .htaccess is the file from which the server "knows" how to interpret different HTTP file requests.
     
    Ultrabooked, Mar 16, 2012 IP
  4. hunk.jaat

    hunk.jaat Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you have to use post method in form for example:-
     
    hunk.jaat, Mar 16, 2012 IP