Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

direct link to image tries to download index.php file #241

chaoscb7 opened this Issue Jun 13, 2012 · 11 comments


None yet
6 participants

While I can bring up the direct links to the thumbs just fine, when I try and post a direct link to the actual image it tries to download a index.php instead of just showing the image. This is for everyone who tries to click on the link.


shish commented Jun 14, 2012

Can you enable nice URLs in the board config? That should fix this, and make pretty much everything work better~

beside nice URL the box is grayed out and says (test failed) beside it.


DakuTree commented Jun 14, 2012

I actually had the same issue (grayed out nice urls box) a while ago. Had two boards running the same version yet one of them wouldn't let me set it without forcing it in the config.php, the other one worked fine.

I tried forcing it through the advanced settings and it just gave me error pages. I had to set it back to N. I'm running this on IIS7 and the wordpress site that's running on it uses the short urls just fine so I'm at a loss.

I think it is a server configuration issue. I am currently experiencing similar problems trying to set up Nice URLs.
When the Board Config page is testing, I found out that I have an extra trailing slash in the URL it is testing against.

Go to /ext/setup/main.php and figure out the URL that it is testing against by putting
echo $test_url;
shortly after line 253.
Reload the board config page, and you'll see the url it tests against at the very top. In my case, it was "http://mysite.com//nicetest"
The double slashes cause a 404 error, which causes the test to fail. Manually setting Nice URLs breaks my setup completely, and can only be fixed by changing the settings in the database, as the Board Config page is no longer accessible.

I couldn't get the url to show up using the method you stated but I did run into double slashs when I tried enabling nice urls using IIS. It works fine on a test page but i end up with the double slash on shimmie.

I've been trying to trouble shoot this by looking at similar issues people have had with other stuff but I'm just at a loss.

jjsev commented Jun 28, 2012

I'm having the same problem, but the URL being tested against does not include double slashes in my case (btw, you can see the value of $test_url in the source of the board config page, just look for the line that says "http_request.open('GET', 'http://www.example.com/nicetest', false);" - the PHP puts it in the URL slot).

I don't mean to parade my ignorance, but I don't understand what the javascript is trying to do. I mean, the file nicetest does not exist, and when the conditional fails, it's because http_request.status is '404', and http_request.responseText is blank. If I create a file nicetest where the URL points, I get http_request.status '200', but http_request.responseText is still blank, so the conditional still fails.

Hmm, could it be a same-origin issue? This guy also had an empty responseText: http://stackoverflow.com/questions/1941340/empty-responsetext-from-xmlhttprequest

jjsev, thanks for the info on $test_url

I think the Javascript controls whether or not you can click the radio button. The underlying logic is a means of seeing if www.yoursite.com/nicetest redirects to www.yoursite.com/index.php?q=nicetest
If you create a file named "nicetest", it will be accessed, return a 200, and the javascript test will be true, allowing you to set nice_urls from your config screen. (edit: this won't solve the issue)

I'm only speculating, but I think that the empty response text may be a result of a 404 error and a missing 404 page. If you access www.yoursite.com/index.php?q=nicetest, you will likely see only the word "ok" displayed on the page.

I looked into my situation a bit more, and the cause of the double slashes is $_SERVER["PATH_INFO"], but changing these to a single slash didn't fix anything. This has got to be an issue with my server configuration, and not Shimmie.

Another edit: It was totally the config file in my case.
I am using nginx, and changed the rewrites to the following;

    rewrite "^(.*)/_images/([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{28}).*$" /$1/images/$2/$2$3$4 break;
    rewrite "^(.*)/_thumbs/([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{28}).*$" /$1/thumbs/$2/$2$3$4 break;
    rewrite "^(.*)/(.*)\.(php|css|js|gif|png|jpg|ico|html|manifest|appcache|txt|jar)$" /$1/$2.$3 break;
    rewrite "^(.*)/(.*)\?(.*)$ /$1/index.php?q=$2&$3" last;
    rewrite "^(.*)/(.*)$ /$1/index.php?q=$2" last;
    #notice the lack of quotes? For whatever reason, this is what fixed it
    rewrite ^/(.*)$ /index.php?q=$1 last;

jjsev commented Jun 28, 2012

Well, this is embarrassing: A few days ago I moved my install of Shimmie to a different directory, and I forgot to bring over the .htaccess file. This issue has been resolved for me.

Ok well it seems the main issue is that IIS dosn't use htaccess it uses web.config. It also doesn't understand mod_rewrite since its for apache. I used the fallowing link http://learn.iis.net/page.aspx/470/importing-apache-modrewrite-rules/ to get the nice url box to stop saying test failed. My issue now is that all the images are broken. All the web pages work fine with the nice url but none of the images.

here is the code that iis is using: http://pastebin.com/m0XxFkzs
here is an example of the image urls: http://mysite.net/_images/fbd29f6a22acc2633533e5d5c7dcb2bf/4708%20-%20tagme.jpg


jgen commented Feb 16, 2014

This is/was a server configuration issue. Closing.

@jgen jgen closed this Feb 16, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment