Jump to content

How to make a redirect like this


sphinx

Recommended Posts

Hi I had it on my old site but forgot what I put in the index.php file.

 

Basicly, I want something like this:

 

http://site.com/index.php?go=home

 

or:

 

http://site.com/index.php?home

 

Does anyone know what I put in the index.php file to specify link and where it redirects too?

 

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/214265-how-to-make-a-redirect-like-this/
Share on other sites

everything behind the question mark is called the query string.

 

To get it you use

$_SERVER['QUERY_STRING'];

 

for example:

echo $_SERVER['QUERY_STRING'];

http://localhost/index.php?home

will show 'home'

 

http://localhost/index.php?go=home

will show 'go=home'

 

Using $_GET will give you an array of all the keys and values in the query string:

echo $_GET['go'];

will show 'home'.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.