Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts

    How to change ?news=main&title=my%20title to /news/my%20title

    Hy all.

    I'm new to PHP, and i built my first class template. Basicly it switches content by get variables main and title

    Main is array of mostly main titles like Index, News, (i haven't reached to contact yes, couse i don't know how to include file, depending on get) but that's the first part.
    Now when user reaches for index (or just visits the site) another menu is set, which is array of index Titles, and Paths.

    Now ugly part is how can i change url in top, from ?main=news to just /news, and let's say ?main=news?title=My news title to /news/mynewstitle

    Is this maybe .htaccess question?
    Thanks

  • #2
    New Coder
    Join Date
    Feb 2007
    Location
    NM. USA
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts
    yes it is! It is a mod_rewrite question actually. There are many examples of how to do this type thing if you search Google for example.

    The Apache HTTP server has a rewrite engine called mod_rewrite, which has been described as "the Swiss Army knife of URL manipulation". A simpler module, mod_alias, allows for simpler rewriting. **From wikipedia, this has lots of good links to look into it further.



    "You cannot escape the responsibility of tomorrow by evading it today." Abraham Lincoln
    Company – Projects ( – Microstock Image Search (Search Dreamstime, Fotolia and other agencies from one site))

  • #3
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Does it lower the performance of the webiste?

  • #4
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Ok, i figured it out.

    If you request eg /?main=index, you cant change it to /index. But you can then use /index to go to link to /?main=index. So that means, if i used PHP script to create links like this href="?main=index", i have to change them all to href="index", but GET will then use rewrite condition of /index, and parse it like ?main="index".

    Am i right!?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •