phbock Posted July 24, 2006 Share Posted July 24, 2006 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 formysite/main.php%3Fcmd%3Dhelpinstead ofmysite/main.php?cmd=helpcan i fix that? Say with an htaccess entry?(Running apache php mysql on a shared server with godaddy)thx a lotPhillip[b][/b] Quote Link to comment https://forums.phpfreaks.com/topic/15453-help-with-3f-and-rewrite-htaccess/ Share on other sites More sharing options...
tyrant1337 Posted July 24, 2006 Share Posted July 24, 2006 If you want to rewrite a url you would need to add the following to your htaccess[code]RewriteEngine onRewriteRule ^main/([A-Za-z0-9-]+)/?$ /main.php?cmd=$1 [nc][/code]You'll end up with the url mysite/main/help/ Quote Link to comment https://forums.phpfreaks.com/topic/15453-help-with-3f-and-rewrite-htaccess/#findComment-62721 Share on other sites More sharing options...
shoz Posted July 24, 2006 Share Posted July 24, 2006 [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 formysite/main.php%3Fcmd%3Dhelpinstead ofmysite/main.php?cmd=helpcan i fix that? Say with an htaccess entry?(Running apache php mysql on a shared server with godaddy)thx a lotPhillip[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 Link to comment https://forums.phpfreaks.com/topic/15453-help-with-3f-and-rewrite-htaccess/#findComment-62876 Share on other sites More sharing options...
phbock Posted July 24, 2006 Author Share Posted July 24, 2006 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?thxPhillip Quote Link to comment https://forums.phpfreaks.com/topic/15453-help-with-3f-and-rewrite-htaccess/#findComment-62917 Share on other sites More sharing options...
shoz Posted July 24, 2006 Share Posted July 24, 2006 [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?thxPhillip[/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]<?phpif (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] Quote Link to comment https://forums.phpfreaks.com/topic/15453-help-with-3f-and-rewrite-htaccess/#findComment-62986 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.