0

I have a page on the url www.example.com/some/info.
This page sends a form to a PHP script.
Is there a way to get this url in the PHP script so that I can redirect to it when the script executes?
I tried $_SERVER['REMOTE_HOST'], but got an undefined index exception.

Edit: I am using Apache's rewrite module so that all the requests are redirected to index.php which then handles resolving them.

Banana
  • 4,010
  • 9
  • 33
  • 49
  • I combined the first and second answers here and got pretty good results: http://stackoverflow.com/questions/6768793/php-get-the-full-url – NotGaeL Sep 21 '13 at 10:19

2 Answers2

2

try concept of referral url

<?php
    print_r($_SERVER['HTTP_REFERER']);
?>
Janak Prajapati
  • 896
  • 1
  • 9
  • 36
1

Try using $_SERVER['REQUEST_URI']

by this, you will be able to get your current URL.

Adarsh Nahar
  • 319
  • 3
  • 10