PHP hiding the variable type but showing the value.

by 4 replies
5
Hi Guys,

Does anyone know how I can change a url from this:

example.com/?id=example1

to:

example.com/example1

when using a GET variable,
ie. taking out "?id=" in the url and showing just the value?

I have seen other people using this but I have no idea how to use it myself,

Thanks in advance
#programming #hiding #php #showing #type #variable
  • They use HTACCESS to get the variable in the URL and silently send you to the PHP page, with that variable in the URL.

    User goes to example.com/example
    HTACCESS takes the example variable and puts it into a GET variable like example.com/?id=example
    HTACCESS silently redirects the page to the PHP script
    • [1] reply
    • ok, i'll look into it, thanks for your reply
  • It called mod rewrite. You put rules into your .htaccess file and Apache will "rewrite" the pretty url to the correct url.
    • [1] reply
    • .htaccess is the way to go.

      You could also look into using an mvc framework like CodeIgniter, CakePHP or Recess.

Next Topics on Trending Feed