By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,805 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,805 IT Pros & Developers. It's quick & easy.

PHP urls with variable data in search engine results

P: n/a
Howdy
I've been given conflicting answers about search engines picking up
urls like: http://mysite.com/index.php?var1=1&var2=2&var3=3
Do search engines pick up these urls?
I've been considering converting a site of mine to PHP-Nuke, but if
the individual modules aren't picked up in search engines I'm not
going to do it.
Thanks
phpKid
Jul 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> I've been given conflicting answers about search engines picking up
urls like: http://mysite.com/index.php?var1=1&var2=2&var3=3
Do search engines pick up these urls?


For the most part, Google is the only search engine that counts. :-)

Google seems to be okay with URLs like that - as long as it finds the URL
within a site, it'll follow it and index it. Of course, you don't want
something like an ID in the that will change with each session. The URL
should always be the same for the same page.

To make the URLs shorter and to make it more likely that search engines will
index the page, you might do something like I'm doing with most of my pages.

I use Apache's Rewrite directive to shorten the URLs and make them look like
normal .html. For example, I have the following in my .htaccess file:

RewriteEngine on
RewriteRule ^news-(.*)-(.*)\.html$
index.php?nilsson=1&action=HOME&subaction=DISPLAY& detail=$1&articleref=$2

This makes the following URL:

http://www.harrynilsson.com/news-48-24269.html

do the same as:
http://www.harrynilsson.com/index.ph...ticleref=24269

Another trick you can use is to add "AcceptPathInfo On" to the .htaccess
file. Then you can use a URL like:

http://www.harrynilsson.com/index.ph...splay/48/24269

Inside your php code, $_SERVER [ 'PATH_INFO' ] will be set to
"/home/display/48/24269". You can "explode" it into the individual
parameters:

list($action, $subaction, $detail, $articleref) = explode("/",
$_SERVER['PATH_INFO']);

I prefer the first method even though it requires editing the .htaccess file
for different sets of parameters. I don't have any good reason for
prefering the method other than that the URLs look more like regular HTML
pages.

-- Roger
Harry Nilsson's "The Point!" on DVD
http://www.harrynilsson.com/news-48-24269.html
Jul 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.