Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   PHP hiding the variable type but showing the value. (https://www.warriorforum.com/programming/430430-php-hiding-variable-type-but-showing-value.html)

Chazbo 10th August 2011 08:35 AM

PHP hiding the variable type but showing the value.
 
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

Speedyapoc 10th August 2011 09:26 AM

Re: PHP hiding the variable type but showing the value.
 
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

Chazbo 10th August 2011 09:42 AM

Re: PHP hiding the variable type but showing the value.
 
ok, i'll look into it, thanks for your reply

dudeontheweb 10th August 2011 10:27 AM

Re: PHP hiding the variable type but showing the value.
 
It called mod rewrite. You put rules into your .htaccess file and Apache will "rewrite" the pretty url to the correct url.

723Media 10th August 2011 07:47 PM

Re: PHP hiding the variable type but showing the value.
 
.htaccess is the way to go.

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


All times are GMT -6. The time now is 11:19 PM.