Jump to content

Recommended Posts

Hi,

looking for help on:

if I go to Google's cache of my site (s)he gives me an error message. The cause might be in the fact that google looks for
mysite/main.php%3Fcmd%3Dhelp

instead of

mysite/main.php?cmd=help

can i fix that? Say with an htaccess entry?

(Running apache php mysql on a shared server with godaddy)

thx a lot
Phillip[b][/b]
Link to comment
https://forums.phpfreaks.com/topic/15453-help-with-3f-and-rewrite-htaccess/
Share on other sites

[quote author=phbock link=topic=101628.msg402349#msg402349 date=1153724521]
Hi,

looking for help on:

if I go to Google's cache of my site (s)he gives me an error message. The cause might be in the fact that google looks for
mysite/main.php%3Fcmd%3Dhelp

instead of

mysite/main.php?cmd=help

can i fix that? Say with an htaccess entry?

(Running apache php mysql on a shared server with godaddy)

thx a lot
Phillip[b][/b]
[/quote]
The %3f and %3D are the [url=http://www.php.net/urlencode]urlencoded[/url] values for ? and =. You see them in the url when you're looking at the cached version because google passes them as part of an argument in the query string. Because of their special meaning in the query string they are encoded to avoid ambiguity.

If you look at the cached version of other pages that have a query string, you should see the same thing.
[quote author=phbock link=topic=101628.msg402625#msg402625 date=1153756030]
shoz,

I somehow figured that. My question is: How is googlebot sending the request?

If I punch in the %3F version my php script does not read that properly. Is that a problem?

thx
Phillip
[/quote]
The %3F is only passed to google's script/app and what it receives is "?" and "=" not "%3f" and "%3d". The output of the cached version of the page is then sent to you. Google should have no interaction with your page when sending you the cached version.

When googlebot is indexing your site it sends the request properly.

This is an example to demonstrate what googles cache app receives.
[code]
<?php
if (isset($_GET['url']))
{
    echo "Look at the url. You should see %3f etc if you entered a url with a query string<br  /><br />\n\n";
    echo "This is the url the script received: " .$_GET['url'];
}
else
{
  echo <<<NNN
<form action="{$_SERVER['SCRIPT_NAME']}" method="get">
<p>
Enter a url. eg: "www.foo.com/index.php?cmd=help<br />
<input name="url" type="text" value="enter a url" />
<input type="submit" value="submit">
</p>
</form>
NNN;
}
?>
[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.