0

If a user is in a page www.sitename.com/folder/index.php and he clicks on a url to another page/site but the second page should not detect that the user is coming from www.sitename.com/folder/index.php instead it should show www.sitename.com/someting/somethingelse

in short I want to manipulate the source url

is the htaccess rewrite going to help ?

Shijil T
  • 49
  • 1
  • 9

2 Answers2

0

I agree with Mojtaba.

From original page, you can link to www.sitename.com/someting/somethingelse, which automatically redirects to target page.

Atrix
  • 299
  • 2
  • 6
  • Its a redirection code, right ? but the problem is www.sitename.com/someting/somethingelse has content in it , and I cant redirect it. I just mask to manipulate that the click is coming from that particular page... – Shijil T Apr 28 '16 at 17:56
0

For example:

in your page:

<a class='redirectable' href='somewhere'>Link1</a>
<a class='redirectable' href='somewhere'>Link2</a>
<a href='somewhere'>Link3</a>

$(document).ready(function(){
    $('.redirectable').click(function(e){
        e.preventDefault();
        window.location = 'myRedirectPage.php?target=' + $(this).attr('href');
    });  
});

in myRedirectPage.php:

<?php
if(!empty($_GET['target']))
  header('Location: '+trim($_GET['target']));
Mojtaba
  • 4,852
  • 5
  • 21
  • 38
  • Its a redirection code, right ? but the problem is www.sitename.com/someting/somethingelse has content in it , and I cant redirect it. I just mask to manipulate that the click is coming from that particular page... – Shijil T Apr 28 '16 at 17:55
  • you can put the code at the top of it. So, it redirects only when you are passing 'target' parameter. (or any parameter you want) – Mojtaba Apr 28 '16 at 17:59