links in the form index.php?page=text&var

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rsmarsha
Forum Contributor
Posts: 242
Joined: Tue Feb 08, 2005 4:06 am
Location: Leeds, England

links in the form index.php?page=text&var

Post by rsmarsha »

Do links such as index.php?page=text&&var=variable effect the way a search engines ranks pages?

I'm only asking as someone i know has had a company who optimises search rankings, tell them that links such as the one above need to be changed. Not sure if they are going to do it via mod rewrite or another method.

If such links do effect a ranking, then mod rewrite would solve this right?

Thanks in advance for any advice.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Re: links in the form index.php?page=text&var

Post by Roja »

rsmarsha wrote:Do links such as index.php?page=text&&var=variable effect the way a search engines ranks pages?
"A search engine" makes the question a little hard to answer, so let me nitpick a little.

http://searchenginewatch.com/reports/ar ... hp/2156431

Yahoo, Google, MSN, and AOL account for over 90% of searches. So lets focus on them. All four have in the last few years revamped their search algorithm to not be negatively affected by dynamic variables in the url.

I can't make any statements about the other 10%, but for the four major search engines, dynamic urls do NOT hurt your rating anymore. (Each of the four did have that issue at some point in the past, but have resolved that problem).
rsmarsha
Forum Contributor
Posts: 242
Joined: Tue Feb 08, 2005 4:06 am
Location: Leeds, England

Post by rsmarsha »

Thanks for the info. No need to change the links then.

Do you know a good place to look into mod_rewrite? As i havn't used it yet, and could use that to hide dynamic links, for security as well as anything.
sheila
Forum Commoner
Posts: 98
Joined: Mon Sep 05, 2005 9:52 pm
Location: Texas

Post by sheila »

From Google's guidelines http://www.google.com/webmasters/guidelines.html
If you decide to use dynamic pages (i.e., the URL contains a "?" character), be aware that not every search engine spider crawls dynamic pages as well as static pages. It helps to keep the parameters short and the number of them few.
and
Don't use "&id=" as a parameter in your URLs, as we don't include these pages in our index.
I have no idea why they have a problem with 'id'.
ntbd
Forum Newbie
Posts: 21
Joined: Wed Apr 12, 2006 6:42 am

Post by ntbd »

If you want to tidy them up you can save the following into a .htaccess file that must be saved in the root of your website (with index.php).

Code: Select all

RewriteEngine on 
RewriteRule ^pages/([A-Za-z0-9]+)\/?(([A-Za-z0-9]+))?$ index.php?file=$1&var=$3
Then yoursite.com/pages/pagename/options or yoursite.com/pages/pagename will go to index.php?file=pagename&var=options
ntbd
Forum Newbie
Posts: 21
Joined: Wed Apr 12, 2006 6:42 am

Post by ntbd »

Sorry, example not very clear. See it in action on my website pintprice.com where every country apears to have its own folder, and then an html page showing the same data in every currency:

http://www.pintprice.com/region/Iraq will show you the price, then go to aud.htm to see the price in Australian Dollars, etc - all using the above syntax.[/url]
rsmarsha
Forum Contributor
Posts: 242
Joined: Tue Feb 08, 2005 4:06 am
Location: Leeds, England

Post by rsmarsha »

Yeah i've looked at using mod_rewrite, what happens if sometimes you have 2 vars in the link and sometimes more than that?
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Check this out: http://www.webcredible.co.uk/user-frien ... arks.shtml

Note that this is true for September 2004 and I assume that things have changed - I guess that this subject needs some more serious research.
ntbd
Forum Newbie
Posts: 21
Joined: Wed Apr 12, 2006 6:42 am

Post by ntbd »

If you dont know how many vars you might end up using you could use pharse_str() in your PHP to treat one var as multiple vars, or just adjust the regex above to suit.

As far as I know know Google doesn't mind ?pageId=etc type urls, but its a lot nicer looking like this and more intutive if visiters want to guess a URL.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

ntbd wrote:As far as I know know Google doesn't mind ?pageId=etc type urls, but its a lot nicer looking like this and more intutive if visiters want to guess a URL.
For the first part ("Google doesn't mind ?pageId="...) - I'm not sure, see sheila's second quote. With the second part ("but its a lot nicer looking"...) I totally agree with you.
Post Reply