Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
14.3k views
in Q2A Core by
edited by

While checking my server logs today, an awkward entry (requesting a blobid) made me wonder:

gute-mathe-fragen.de/%3fqa=blob&qa_blobid=16679459304048621310/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/?qa=blob&qa_blobid=16679459304048621310/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php

I tested it, and found out that the added %3f is causing the problem, you can try it out yourself with an image:

works: http://www.gute-mathe-fragen.de/?qa=blob&qa_blobid=16679459304048621310

causes a loop, does not work: www.gute-mathe-fragen.de/%3fqa=blob&qa_blobid=16679459304048621310 and changes the URL adding a lot of "index.php" to it.

Might it be that I have to change the htaccess somehow? But is it the one that is redirecting here?

Have no clue...

--

I found out, that the problem occurs not only on BLOBs but also on default URL, e.g. www.gute-mathe-fragen.de/%3f just adding the %3f right after the slash behind the domain name causes the loop!

Q2A version: 1.5.4
by
edited by
Btw, I am using the same URL Rewrite as in default installtion, the only difference:
RewriteBase /
instead
#RewriteBase /

I found something here: http://www.webmasterworld.com/apache/3383764.htm but the rewrite rule for "%3f" did not help...

And I wonder why this issue does not happen with the q2a forum here, check out:
http://www.question2answer.org/qa/?qa=blob&qa_blobid=13375850431636911041
and now:
http://www.question2answer.org/qa/%3fqa=blob&qa_blobid=13375850431636911041
which gives a correct page-not-found.

qa-index.php is also default. Is this any php.ini setting that is different?
by
edited by
I now used the orignal .htaccess of q2a installation, only uncommenting the RewriteBase, still the same index.php redirect problem.

Digging into qa-index.php I see that question mark is to be found here:

$questionpos=strpos($origpath, '?');

and the "index.php" might be added by this line:

$urlformat=( (empty($_SERVER['REQUEST_URI'])) || (strpos($_SERVER['REQUEST_URI'], '/index.php')!==false) )

Could this be the problem? But why is it working with the other forums? Different Apache settings?
--
Probably an Apache decoding problem!
by
Some more news:
1. I cannot reproduce the problem with other q2a sites from the directory
2. I can repdroduce the error with other sites (on other domains), running other software (!)
3. It must be the server settings, but my provider replied me, use htaccess settings, which did not work...

1 Answer

+1 vote
by

Got the answer of my provider, it is an Apache default setting that they would not change.

"Apache uses mod_dir before mod_rewrite that is why the redirect happens.

We recommend not to use %3f in URLs."

Well, I never used %3f in my URLs but the search bots... :(

by
edited by
FYI: I found out that Google understands wildcards in robots.txt. And as the error mainly happens on URLs with "/?qa-blob" I am using now:

Disallow: /*%3Fqa%3Dblob

which will block access to all URLs that include the string "%3Fqa%3Dblob" which is encoded: "?qa=blob".

As google webmaster tools tells me, it works! You can test your robots.txt vs. google robot at: https://www.google.com/webmasters/tools/robots-analysis

²About wildcards and more: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=156449&from=40367&rd=1

³Examples: http://productforums.google.com/forum/#!msg/webmasters/G7WXqB1MLAw/H92N-aE_CIQJ
...