Solved

How Google see my links

Posted on 2014-07-29
2
260 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Wordpress French and English Site 6 79
PHP Echo with auto submit 8 30
check mysql insert 12 28
Hiding Adsense on Mobile Devices 2 30
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

820 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