.htaccess issue

Getting a "installation has changed notice" - I've clicked the upgrade button several times but keep getting it. I'm thinking it's because of my custom .htaccess file as I've made additions to it. I try using the one in the zp-core folder but same issue.

When I delete all .htaccess files and let the install create one...it then tells me THAT on isn't the right version...lol.

What do I need to do?
V 1.4.5

Thanks

Comments

  • acrylian Administrator, Developer
    Did you re-create the setup files? They are now protected after an installation/upgrade. There is a utility button on the admin overview page.
  • I didn't re-create setup files and I never protected them. Just seem to randomly get the installation has changed notice.

    What triggers this notice? I'll assume I'm the only one to see the notice since I'm logged in and normal visitors of the site won't see it?
  • acrylian Administrator, Developer
    That is explained on the install page on our site. The setup scripts are automatically protected with 1.4.5.
  • I understand that but trying to figure out how that relates to my issue. Do I need to un-protect them and run setup again?
  • I'd un-protect them to run it again if you want setup to try to recreate your .htaccess.

    To answer your other question-

    "What triggers this notice? I'll assume I'm the only one to see the notice since I'm logged in and normal visitors of the site won't see it?"

    The notice is triggered by a core script, not meant to be disabled, as a security protocol. It is only visible to you, the logged in administrator. See here:

    http://www.zenphoto.org/news/installation-and-upgrading
  • The notice should have told you what has changed. Only the Admin will see the notice.

    Regards the .htaccess file. The new file should look like:

    `
    # htaccess file version 1.4.5;
    # Rewrite rules are now handled by PHP code
    # See the file "zenphoto-rewrite.txt" for the actual rules
    #
    # These rules redirect everything not directly accessing a file to the Zenphoto index.php script
    #

    IndexIgnore *


    RewriteEngine On

    RewriteBase /zenphoto

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [L]

    RewriteRule ^.*/?$ index.php [L,QSA]


    `
    With the rewrite base modified appropriately for your installation. The first line is the file's version and is what is checked to see if the version is correct. You should be able to simply add your rules now. This file will not change in the future as all our rules are now interpreted by PHP code.
  • So do I add my rules to that file (the one you posted above) or do I add my rules to the zenphoto-rewrite.txt file?

    Thanks
  • acrylian Administrator, Developer
    To that file above as that is the one used. The other one is the template for new installs.
  • Gotcha thanks. Lastly, I can't get the re-direct from /admin to zp-core/admin.php to work...

    This is what is in my old file:
    `RewriteRule ^admin/?$ zp-core/admin.php [R,L]`

    This is the new version...no go either:
    `RewriteRule admin/*$ %ZENFOLDER%/admin.php [L,QSA]`

    If I use my old .htaccess file all together it works...but with the new one no go.
  • acrylian Administrator, Developer
    Actually the admin redirect is standard. What my colleague posted above is all that is in the current htaccess file.
  • Hmmm not working for me. I'll keep messing with it...thanks
  • Start with just the standard .htaccess and be sure first that that works. Then add to it only rules for things outside of Zenphoto. Zenphoto rewrite rules are handled in PHP now.
  • The standard stock .htaccess does not redirect admin....
  • Let's be clear. You did remove any .htaccess file from your installation. Then re-ran setup so that it created a site specific .htaccess file.

    If you ran setup directly then the second page would have a bunch of check icons. The one for mod_rewrite should be a checkmark, not a broken image. If it is a broken image then your site is not processing rewrite rules.

    Also be sure the option for Mod_rewrite is enabled.
  • Yes - I delete all .htaccess files, and when I let setup create the file - setup then instantly tells me the file is out of date and to let it create one. SOOOO, I let install go w/o any .htaccess, then I copy the correct .htaccess file to the server.

    Honestly I've not noticed if the mod-rewrite checkmark is there or not...I give a quick look and they all appear to be checked but don't look at every one specifically. I usually just load the site and then go to the backend.

    Also, I don't run mod_rewrite but for testing even when enabled the redirect doesn't work. I get the 500 Internal Server Error.

    NOW, mod_rewrite is "supposed" to be enabled on the new server I'm on but I do see the "Setup did not detect a working mod_rewrite facility" message under options/general so not sure what that means.

    Additionally, I have several redirect 301's in the new .htaccess file and they work just fine.

    As mentioned before, if I copy my old .htaccess file over then the admin redirect works fine...so I'm at a loss...
  • acrylian Administrator, Developer
    I fear we are at a loss as well. It is certainly working on standard shared hosts (Linux/Apache) and local MAMP/WAMP installs we use for testing and also our own server using nginx.
  • Just for kicks...here are the two files...maybe I'm missing something...

    This is the latest .htaccess file - I've added some 301 redirect...works fine but no admin redirect...

    `
    # htaccess file version 1.4.5;
    # Rewrite rules are now handled by PHP code
    # See the file "zenphoto-rewrite.txt" for the actual rules
    #
    # These rules redirect everything not directly accessing a file to the Zenphoto index.php script
    #

    IndexIgnore *


    RewriteEngine On

    RewriteBase /zenphoto

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [L]

    RewriteRule ^.*/?$ index.php [L,QSA]

    RewriteRule ^admin/?$ zp-core/admin.php [R,L]

    redirect 301 /ascmclaren_and_mustang_svo_specs.php http://www.mikemartinelli.com/index.php?p=pages&title=ascmclaren-and-mustang-svo-specs
    redirect 301 /79-86_capri_mustang_dash_pad_fix.php http://www.mikemartinelli.com/index.php?p=news&title=79-86-capri-mustang-dash-pad-fix
    redirect 301 /ascmclaren_information.php http://www.mikemartinelli.com/index.php?p=pages&title=ascmclaren-information
    redirect 301 /custom_tshirts.php http://www.mikemartinelli.com/index.php?p=pages&title=custom-t-shirts
    redirect 301 /for_sale.php http://www.mikemartinelli.com/index.php?p=news&category=for-sale
    redirect 301 /ford_mustang_svo_information.php http://www.mikemartinelli.com/index.php?p=pages&title=ford-mustang-svo-information
    redirect 301 /more_ascmclaren_and_mustang_svo_information.php http://www.mikemartinelli.com/index.php?p=pages&title=more-ascmclaren-and-mustang-svo-information
    redirect 301 /mustang_svo_fuzzy_dash_refurbish_how_to.php http://www.mikemartinelli.com/index.php?p=news&title=Mustang+SVO+fuzzy+dash+panel+refurbish
    redirect 301 /mustang_svo_specifications.php http://www.mikemartinelli.com/index.php?p=pages&title=mustang-svo-specifications
    redirect 301 /wild_rides_s-box_installation.php http://www.mikemartinelli.com/index.php?p=news&title=wild-rides-s-box-installation

    redirect 301 /s-box.asp http://www.mikemartinelli.com/index.php?p=news&title=wild-rides-s-box-installation
    redirect 301 /Pictures.htm http://www.mikemartinelli.com/index.php?p=multimedia
    redirect 301 /Contact.asp http://www.mikemartinelli.com/index.php?p=pages&title=ContactMe
    RedirectMatch 301 ^/(.*).asp http://www.mikemartinelli.com/Pictures.htm
    RedirectMatch 301 ^/ImageFolders/.*$ http://www.mikemartinelli.com/index.php?p=multimedia


    `
  • Not letting me post the other file...ughhh
  • acrylian Administrator, Developer
    Try to put the redirects before the Zenphoto ones. If you even need to add somethong for /admin to work something is not right. That really should work out of the box.

    Sadly I am nowhere near a real htaccess expert.
  • The Zenphoto part of these rewrite rules reads as follows:

    Check the URL to be a file or a directory. If it is, just load the URL. If it is not, redirect to the root index.php script.

    If not the above then do the other rewrite rules. But of course, there is no way that you would ever get to these rules because the URL will either point to a file/folder or it will redirect to the index.php script.
Sign In or Register to comment.