There is a mechanism I plan to implement in one of my websites.

Let's say the links in my website don't directly refer to the page they are supposed to but they all refer to a single PHP page and send their unique parameters and that single PHP page based on those parameters does some processing on DB and then redirects to the actual pages those were supposed to refer by using header("Location:$_GET['page_name']");...

  • Will this mechanism be not search engine friendly or is it okay?
  • Will this mechanism get me disadvantages at Google PageRank?

4 Answers 4


If you use a 301 redirect, it would be OK. The whole procedure looks a little strange. Why don't you just use mod_rewrite to have beautiful URL and still render the with one PHP script?

  • actually i need to run a query when a particular link is clicked and then load refereed page.. its complicated
    – user3122
    Nov 23, 2010 at 10:49

Hmm, there's several problems when you do this.

First of all, the real url of the page that is navigated to is not in the original page. Having a page.php?location=Home (where page.php processes your query and redirects to location) for all your links makes people only see the page.php url. I'm not sure how many people actually look at what url they're visiting, but it could be confusing if people see that all links point to the same page. Some websites do this for outgoing links and it always really annoys me I can't see the destination of the link in one glance.

Of course CMS'es like Joomla and MediaWiki do this by default (index.php?id=1) but it's generally accepted that clean urls with no parameters have both better usability and better Google indexing.

Concerning search engines, of course there's the PHP header that can help out. You can just use a 301 redirect code in your header before sending it: http://phpprogrammingguide.blogspot.com/2005/11/php-header-301-redirect-moved.html

That way search engines will associate page.php?location=Home with /home/, ditto for all other pages. You could even go as far as to install Google Webmaster tools and manually point out which of the parameters should be ignored and which shouldn't (location obviously shouldn't be ignored as it lets Google tell apart the different internal links).

Also, adding a rel="canonical" in the pages will help search engines recognize what url should be which. Even if they end up on a page with ?location=x having a canonical url with /x/ will make sure that the right url is indexed.

Another problem is going to be the browser's back button. This is the most used button on the internet, and it won't work on your site if you use this script. Clicking back will take a user to the page.php page and just redirect them forward again, causing much irritation at the user's side and wrong stats at your side.

Last of all, it's really really important not to have page.php break. Sometimes it just happens that a link or page breaks for whatever reasons. One broken page in your site is annoying, but if page.php break ALL internal links are defunct. You could prevent this by letting the script email you as soon as someone encounters an error or whatever, but just be careful.

All in all I'd avoid it if you can do it any other way. There's work-arounds for search engines but it'll hurt your usability no matter what.


Do what you do now, just add the static links to your other pages somewhere on the page (if they are not too many). Problem solved. ;)


I understand your problem. You may want to track users who click in a certain link, or how much of your users go to certain partner, or something like that.

I can't really say what should be indexing problems. The first and unique that came to me now is that your page juice is not passed to target pages, hence search engines will consider those links as internal links.

But I would propose a solution that should work well in most cases. Use AJAX on those links. Use rel attribute into those anchors, like:

<a rel="external" href="http:yourpartner.tld">See more here</a>

Filter links who has rel="external", and attach an event to them. When clicked, it would make an ajax call with their href parameter, which you will query. The AJAX function just need to return true or false in order to allow users to be really redirected to their page, or prevent redirection in case of error.

  • yes you got me right... i actually have categories in my wallpapers blog... i want to know what categories users mostly click to browse... i am looking forward to maintain user activity data and implement intelligence on it....... but the problem is i don't know ajax
    – user3122
    Nov 23, 2010 at 17:44
  • 1
    well... as I can see you have two options. First is learn ajax. There are literally thousands of tutorials over internet. Second is using a service like google analytics (if I got it right, all pages are inside your own site and you just want keep track of users behavior and trends) to keep track of your visitors. Nov 23, 2010 at 22:57
  • Yeah, Analytics is a good tool for this Dec 5, 2010 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.