Skip to main content
Inspiring
March 21, 2012
Question

How to check the url on a specific word

  • March 21, 2012
  • 1 reply
  • 1252 views

Making use of htaccess and Google translate I have buttons to several languages  on my site that send the site  to Google translate. This works OK.

However within Google-translate the same buttons e.g. to switch to another language don't work anymore because of the url has changed.

So my idea is to use PHP to check the url on the word Google so that the buttons are not shown when if it is found.

Is there a way within PHP to check if a particular word is part of the url?

Any help is greatly appreciated.

This topic has been closed for replies.

1 reply

Inspiring
March 21, 2012

HTTP_HOST and SERVER_NAME don't help me out yet.

March 22, 2012

DVita wrote:

HTTP_HOST and SERVER_NAME don't help me out yet.

Gee that didn't help me out either.

How 'bout you provide the link to the page you inquring about and the code you're trying to use so others that might want to help you don't have to try and read your mind or take stab-in-the-dark guesses of a solution to your vague question?

best,

Shocker

Inspiring
March 22, 2012

Thanks for helping.

This is the site: http://www.designvitamine.nl/

It is in Dutch as you see. The language links are on the right.

The code to show or not show works when tested on another website (where it doesn't show) but  not within Google Translate.

I also tried using HTTP_HOST as mentioned. The smily here is mistakenly created by this forum because I used : and ) together.

<?php if($_SERVER['SERVER_NAME'] == ('www.designvitamine.nl')) { ?>

<p id="translate">

<a href="http://www.designvitamine.nl<?php echo $_SERVER['PHP_SELF']; ?>-en" target="_blank">English</a> -

<a href="http://www.designvitamine.nl<?php echo $_SERVER['PHP_SELF']; ?>-de" target="_blank">Deutsch</a> -

<a href="http://www.designvitamine.nl<?php echo $_SERVER['PHP_SELF']; ?>-fr" target="_blank">Fran&ccedil;ais</a> -

<a href="http://www.designvitamine.nl<?php echo $_SERVER['PHP_SELF']; ?>-es" target="_blank">Espa&ntilde;ol</a> -

<a href="http://www.designvitamine.nl<?php echo $_SERVER['PHP_SELF']; ?>-hu" target="_blank">Magyar</a> -

<a href="http://www.designvitamine.nl<?php echo $_SERVER['PHP_SELF']; ?>-u" title="Your local language" target="_blank">   </a> -

<a href="dvita_translate.php">Hoe?</a>

</p>

<?php } ?>