Hi,
i want to execute my code to rewriting url in on the fly and i have to get $_requet values in code

for example
original typed url in browser:

http://localhost/mypet1/a1
http://localhost/mypet1/a1/?page=sp_login
http://localhost/mypet1/a1/index.php
http://localhost/mypet1/a1/index.php?page=sp_login

execution url
http://localhost/mypet1/?sp=a1
http://localhost/mypet1/?sp=a1&page=sp_login
http://localhost/mypet1/index.php?sp=a1
http://localhost/mypet1/index.php?sp=a1&page=sp_login

i need to get in my code
$_REquest['sp']; value is a1 for above example

any one help me to do this

Regards
Bala

    You can do this with mod_rewrite if you use apache

      i am using apache only
      can u provide .htaccess file code for this

        <IfModule mod_rewrite.c>
          RewriteEngine on
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
        </IfModule>

        Try that and add

        <?php
        echo '<pre>';
        print_r($_REQUEST);
        echo '</pre>';

        to your index. Then you will all the variables that are passed and can play around with them further from there.

        HTH.

        PS: Make sure that mod_rewrite is enabled 🙂

        LoadModule rewrite_module modules/mod_rewrite.so

          Hi
          This is i want.
          Thank you very much.

          Regards
          Bala

            Write a Reply...