mod_rewrite breaks admin.php but not index.php

After much trouble I have an .htaccess file, loaded and working. I have verified with my host (dreamhost) that mod_rewrite is infact installed. I have turned on mod_rewrite in the admin page and in the .htaccess file. What happens though is when the .htaccess file has the rewrite engine turned on, index.php and all the albums, images, and search pages seem to work, but my phpinfo.php page, setup.php and admin.php pages stop working. They report the error "No input file specified." This happens whether or not I turn mod_rewrite on in the admin page, which I do by turning mod_rewrite off in the .htaccess page so I can get to the admin page.

Mod_rewrite is making my URLs clean, its just that I cant access the admin section now.

Comments

  • Something is wrong with your .htaccess file. The pages that you say fail do NOT make use of mod_rewrite URLs. Is it the file that came with the zenphoto release? Do you have any other .htaccess files in your installation?
  • Miem Member
    I have the same problem on one of my servers. I asked the hosting company, but they say everything on the server is all right. If I put the .htaccess on the server I get te following error in the server log files: [Mon Jul 21 09:47:29 2008] [error] [client xxx.xxx.xxx.xx] Premature end of script headers: php-script
  • I'm having a very similar problem. My domain is hosted at Dreamhost, and I installed ZenPhoto 1.1.7 into the root of my site. I edited the .htaccess file that came with the release to set my RewriteBase to "/" and turned on the ZenPhoto mod_rewrite option. I can still view the gallery, but if I attempt to access any admin functions, I see only the words "No input file specified." Renaming the .htaccess file to .htaccess-disabled makes the admin stuff work again.
  • nsander: I found the same thing happened. If you disable it, go to your admin page and turn on mod_rewrite, then change the .htaccess name back, you will find those files not working again but the rest of the site gets pretty URLs.

    sbillard:
    I have tracked the problem down to the last line of the .htaccess file before the endif.
    `RewriteRule ^(.*)/?$ index.php?album=$1 [L,QSA]`
    If I comment out this line with a # the rest of the nice URLs stop working, clicking on an album thumbnail no longer works, but the setup.php, phpinfo.php, and admin.php files can be accessed again. If I take the comment out and let the line work, those files return the error but the album, image, and search pages load again.
  • I am no rewrite expert, but there are rules at the beginning of the file which are supposed to activate when the target is an existing file and just pass it through. Seems these rules must not be working for you.
  • ttdttd Member
    I stumbled upon the same findings, depending on what Dreamhost web server you are on you may end up with this issue.

    As you discovered jasronq, commenting out the last htaccess line fixes some pages but breaks others. I think that sbillard is onto something about the rules at the beginning but changing them has had no effect for me thus far.
  • Hi to all,
    I get similar problems with netsons.org, an italian host.
    As jasronq discovered, the core of the problem is the last line in .htaccess file.
    If I don't comment it, I get a 500 code error when trying to access admin.php page.
    It seems to break some policy rule on their server.
    So far I was not able to solve the problem...
  • acrylian Administrator, Developer
    Minor update on that without solution yet: I can confirm that there is something wrong with our htaccess file for some server setups somehow. I moved to a new host and run into the same trouble. My host has no idea nor do I, so I hope I get that solved somehow.
  • I'm chiming in with the same issue. On Dreamhost. Worked fine for ages, now can't log in to admin.php - new behavior within the last week or two. Have no idea if Dreamhost changed the configuration of the server I'm on or not. I know I haven't changed anything. Odd. I'll be following this thread in case someone comes up with a solution!
    Steve
  • acrylian Administrator, Developer
    I was with the help of krainbolt and sbillard (and a little of my provider) able to fix it. It is just a small change you might want to try. Locate this rewrite rule in the htaccess file:

    `RewriteRule ^.*$ - [R,L]`

    and remove the R so it looks like

    `RewriteRule ^.*$ - [L]`

    Please report if that fixes your issues, too.
  • this didn't solve anything @dreamhost. :-( did it work for anyone else using dreamhost?
  • acrylian Administrator, Developer
    I should probably have said, it fixed my problem. I am not on Dreamhost nor do I have access to it, so I of course can not say anthing about it or any other provider.
  • ooops! it works perfectly fine on dreamhost, i'm just clumsy! thanks acrylian!
  • acrylian - that fixed it for me on DreamHost *and* also cleared up an odd problem I just noticed where some images failed to show up. (All thumbnails were fine. The links to the un-resized images were fine. Some thumbnails however pointed to images that didn't show up)
    Fantastic - back in top working order. THANKS!!
    But I wonder what caused this, since it seemed recent.

    Steve
  • Yessss, this makes it work for me.
  • I got a nice form letter from DreamHost support in response to my question. Since it wasn't directed at me specifically there isn't an exact reason why [R,L] in the RewriteRule stopped working in some cases, but one paragraph indicated some problems w/ htaccess:

    2. Recent changes to Apache 2 caused anybody using AuthGroupFile in their
    .htaccess to get errors. It turns out this was an oversight. The module
    was recently added to Apache 2 and our servers have been reconfigured -
    so this should be fixed now. If you continue to see errors tho, you
    might want to attempt commenting out the AuthGroupFile line in your
    .htaccess file (adding a "#" to the beginning of the line should do) and
    reloading your page.

    So maybe now that they have changed things the original zenphoto htaccess file will work, but since I'm not having problems with the modified version I'm not going to change it back!

    Thanks again acrylian. That was FAST work!

    Steve
  • acrylian Administrator, Developer
    Thanks for the feedback! Glad it seems to work for you all, too. I am nearly thankful now that I ran into the problem with my new host myself, even if it caused some work and headache...:-)
  • We have formalized the .htaccess change, so zenphoto is not going back either!
  • Brilliant! Works also on my site.
    Thanks a million for fixing this error.
Sign In or Register to comment.