Solved

How Google see my links

Posted on 2014-07-29
2
254 Views
Last Modified: 2014-07-29
Hi E's,
I got a solution to create friendly URL's in my project, but not sure how Google will save or show these links.
The fact that I save the name of the friendly URL's in a database does not allow me to use the normal rewrite mode, so,
I had to opt for a slightly different solution, as you can see in this issue: EE Question

Basically this is the mechanism at work:mechanism
This simple example work in this way.
In index.php I have a link, with a friendly URL. When I click, .htaccess redirects to router.php. router.php will send to the real URL, in this case was article.php, but can be any URL. At first had this URL www.mydomain.com/article-eight-seven-eigth and at the end I will have a page with the real URL, like www.mydomain.com/article.php?id=878

This is the code of all files:
index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>home</title>
</head>
<body>
<p><a href="article-eight-seven-eigth">article 878</a></p>
</body>
</html>

Open in new window

.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ router.php [L]

Open in new window

router.php
<?php
//I will check url and redirect page based and that url

header( "Location: article.php?id=878" ) ; 
?>

Open in new window

article.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>article</title>
</head>
<body>
<p>the number of article is: <? echo $_GET['id']; ?></p>
</body>
</html>

Open in new window

So, my question is, how google will index the page, www.mydomain.com/article-eight-seven-eigth or www.mydomain.com/article.php?id=878?

The best regards, JC
0
Comment
Question by:Pedro Chagas
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40227471
Google will index
www.mydomain.com/article-eight-seven-eigth

It will never see
www.mydomain.com/article.php?id=878
as that is for internal use only

But don't use something like article-eight-seven-eigth for the url, use the actual article title using the function I gave you in the other question to create the url from the title.
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 40227482
Hi @Gary,
Again, thank you very much.
Yes, I will use the name of articles like you recommend. article-eight-seven-eigth is just a example.

The best regards, JC
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now