Solved

How Google see my links

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

If you don’t want your company's site to fail on the web, you’d do well to observe these best web design practices and make sure you implement them when applicable.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

770 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