Link to home
Start Free TrialLog in
Avatar of Pedro Chagas
Pedro ChagasFlag for Portugal

asked on

How Google see my links

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:User generated image
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
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pedro Chagas

ASKER

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