Hi,
I am using a dynamic redirect to take vistors to the database stored
url as in this part of the script: -
$sql = "SELECT ad_link FROM adverts WHERE advert_id = $N_ad_id";
-
$result = mysql_query($sql) or die("could not execute find PRODUCTS query". mysql_error());
-
$num = mysql_num_rows($result);
-
-
if ($num == 0 ) {
-
echo "There an ERROR in locating this product.";
-
} // endif
-
else{
-
$row = mysql_fetch_assoc($result);
-
$N_ad_link = "http://".$row["ad_link"];
-
-
$sql = "UPDATE adverts SET click_cnt = click_cnt+1 WHERE advert_id = $N_ad_id";
-
mysql_query($sql) or die("could not execute adverts update query". mysql_error());
-
-
header("Location: $N_ad_link");
-
exit();
-
Now I want to ensure that search engine robots and web crawlers do not
index these links. Can I insert a bit of html code to accomplish this ?
EG -
$sql = "UPDATE adverts SET click_cnt = click_cnt+1 WHERE advert_id = $N_ad_id";
-
mysql_query($sql) or die("could not execute adverts update query". mysql_error());
-
-
echo "
-
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
-
\"http://www.w3.org/TR/html4/loose.dtd\">
-
-
<html>
-
<head>
-
<title>Temp Page</title>
-
<meta name=\"allow-search\" content=\"no\">
-
<meta name=\"robots\" content=\"all, noindex, nofollow\">
-
</head>
-
<body>
-
header(\"Location: $N_ad_link\");
-
</body>
-
</html>";
-
-
exit();
-
I have escaped the double quotes because they are inside the
echo statement.
Is the header(\"Locati on: $N_ad_link\"); in the correct place ?
Do you think this is the best way to do it ?
Thanks for any advice.
PS
Maybe I should use a meta-refresh instead:
So in the above html I will put: -
echo "<html>
-
<head>
-
<title>Temp Page</title>
-
<meta name=\"allow-search\" content=\"no\">
-
<meta name=\"robots\" content=\"all, noindex, nofollow\">
-
<meta http-equiv ='refresh' content = '0;url = $N_ad_link'>
-
</head>
-
<body>
-
</body>
-
</html>";
Is this a better method ?
4 3055 Markus 6,050
Recognized Expert Expert
Second example will you a 'headers already sent' error.
I believe setting the header to a 301 redirect will discourage spiders from indexing it - 301 is a permanent move. I may be wrong. -
header( "HTTP/1.1 301 Moved Permanently" );
-
header( "Location: ..." );
-
Thanks for your reply,
I should mention that with the
suggestions above, the code is being loaded
from a .htaccess re-write command.
So the rewrite is like this:
RewriteRule ^[\.-a-z]+/bonuses-K([0-9]+)\.html$ ad_linker.php?a =$1 [NC,QSA,L]
and then the ad_linker.php?a =$1 code
will look like this: -
require_once("my_functions.php");
-
-
$today = date("U");
-
-
if(isset($_GET["a"])){
-
$N_ad_id = safe_sql($_GET["a"]);
-
-
$sql = "SELECT ad_link FROM adverts WHERE advert_id = $N_ad_id";
-
$result = mysql_query($sql) or die("could not execute find PRODUCTS query". mysql_error());
-
$num = mysql_num_rows($result);
-
-
if ($num == 0 ) {
-
echo "There an ERROR in locating this product.";
-
} // endif
-
else{
-
$row = mysql_fetch_assoc($result);
-
$N_ad_link = "http://".$row["ad_link"];
-
-
// update database
-
$sql = "UPDATE adverts SET click_cnt = click_cnt+1 WHERE advert_id = $N_ad_id";
-
mysql_query($sql) or die("could not execute adverts update query". mysql_error());
-
-
echo "<html>
-
<head>
-
<title>Temp Page</title>
-
<meta name=\"allow-search\" content=\"no\">
-
<meta name=\"robots\" content=\"all, noindex, nofollow\">
-
<meta http-equiv ='refresh' content = '0;url = $N_ad_link'>
-
</head>
-
<body>
-
</body>
-
</html>";
-
exit();
-
} // end else
-
} // endif
-
echo "No Link data !! - please inform admin";
-
-
?>
Do you see any problems with this ?
( I don't think headers sent earlier will be a problem as this is a new page,
unless I misunderstood )
Thanks
Hi Marcus ( or anyone else)
What did you think of this as a solution ?
Have I misunderstood anything ?
Should it work OK ?
Markus 6,050
Recognized Expert Expert @jeddiki
Sure, if it works for you, then ok. But it's more code that what is necessary; the page loading the html isn't needed, and will just make it a tad slower. I'm pretty sure my post above would prevent spiders from following the redirect.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: deko |
last post by:
I'm trying to create a very basic login page that will redirect a logged in
user to a secure page. I set the session_start variable at the top of the
login page, then redirect to securePage.php if the user enters the right
credentials.
The redirect works, but apparently $HTTP_SESSION_VARS is not
getting set because I cannot view securePage.php.
Am I setting $HTTP_SESSION_VARS correctly? My guess is I'm missing
something elementary. ...
|
by: Steve Lutz |
last post by:
Hello,
I have a page that creates a class, and then on certain conditions,
redirects user to another page. The class has a Class_Terminate() function
that saves itself to a database. The class comes from an includes ASP file,
it isn't a COM object.
Here's my code outline (not actual code for brevity - in otherwords, there
may be syntax errors, but that's not the cause of the problem)
|
by: Steve Mauldin |
last post by:
This is a standard ASP application that has several pages at the root
withthe global.asa. I set a session variable session("accountid") =
"123456" within an asp page and then response.redirect to the next page and
immediately response.write session("accountid") and I get back nothing.
But if I set a session variable session("accountid") = "123456" within an
asp page and response.redirect to a page in a sub directory and immediately...
|
by: alex p |
last post by:
I have create a website that links to other websites, using a
response.redirect("URL_OF_WEBSITE")
For some reason I have managed to get on top at Google, with these pages
that only redirect to a website of an affiliate program of mine.
The problem now is that the affiliate program thinks that Google is the
referer instead of me. What can I do to prevent this.
Is there a way to somehow alter the change the HTTP_REFERER when I use...
|
by: Philipp Lenssen |
last post by:
There's a new quasi-standard in the world of HTML; the <a
rel="nofollow" href="...">...</a>. It is already or soon implemented in
Google, Yahoo, and MSN Search, as well as many different blogging
products. The intent? To battle comment, referrer, and trackback spam.
My comments on this are in my blog:
Rel Nofollow Details (Introduction)
http://blog.outer-court.com/archive/2005-01-19-n46.html
Nofollow in Firefox (User-stylesheets)
| |
by: Adam Clauss |
last post by:
I have a webapp which consists of several different webforms.
Basically:
(1) view the contents of a database
(2) one is to add a new entry
(3) confirms the new entry.
The third form, upon confirming the entry (in a button_clicked handler) adds
the entry into the database and then redirects back to (2) using
Response.Redirect(..)
|
by: needin4mation |
last post by:
I remember in 1.1 that I would put not to populate a given dropdownlist
unless it was not Page.IsPostBack. But in 2.0 where I use the DAL and
no codefile, I don't see where to effect this. Any help is
appreciated. I want my dropdownlist to keep what the use selected when
the page refreshes. Thanks.
|
by: David Lozzi |
last post by:
Hello there,
I'm getting the following error
System.NullReferenceException: Object reference not set to an instance of an
object.
at shopping_bag.GetBagTotals()
|
by: FFMG |
last post by:
Hi,
I run a blog hosting site and it is a fairly small community easy
enough to police.
But some spammers still find ways to get in.
What I was thinking is adding nofollow tags to their links until they
reach a certain amount of posts, (or until I've had time to review
their account).
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |