Problems with using different root directories  Bottom

  • I've installed Zikula 1.2.4 in a folder like this.

    http://www.yourdomain.com/Pages/Project/z124

    I have added the following to my .htaccess file.

    Code

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$
    RewriteCond
    %{REQUEST_URI} !^/Pages/Project/z124
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond
    %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /Pages/Project/z124/
    RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$
    RewriteRule ^(/)?$ /Pages/Project/z124/index.php [L]

    and it loads the home page just right when I go to http://www.yourdomain.com

    When I try to login it gives me the following error.

    Sorry! Invalid authorisation key ('authkey'). This is probably either because you pressed the 'Back' button to return to a page which does not allow that, or else because the page's authorisation key expired due to prolonged inactivity. Please refresh the page and try again.

    and in the address bar is the following.

    http://www.yourdomain.com/Pages/Project/z124/index.php?module=users&func=loginscreen

    and now I can login without error.

    How can I solve the authkey problem and prevent the URL from changing?



    Edited by maverick on Aug 31, 2010 - 06:38 AM.
  • I ran into something similar myself some time ago. Zikula does not support hiding directory levels with mod_rewrite.

    --
    - Robert

    Ohloh profile for Robert Burkhead

    Stack Overflow profile for RobertB at Stack Overflow, Q&A for professional and enthusiast programmers
  • rmburkhead

    I ran into something similar myself some time ago. Zikula does not support hiding directory levels with mod_rewrite.


    Is there some type of workaround?
    This account has multiple domains and has different web apps installed, I hate to put anything in the root folder period.
    Leaves room for testing and setting up updated versions etc..

    Seems this has been documented before, but its currently marked as fixed.
    http://code.zikula.org/core/ticket/864

    Seems you filed it too.....lol
    Didn't even look



    Edited by maverick on Aug 31, 2010 - 07:25 PM.
  • Unfortunately, any fix made in connection with #864 was reverted in change set 25867 (which is no longer linkable). I updated the ticket status to reflect that.

    The issue was reopened in ticket #1117, and remains unresolved.

    AFAIK, there is no workaround, other than hacking the core. I proposed a few different ideas, most of which are outlined on the two tickets, but none were accepted. Some broke short URLs, others were not accepted for other reasons.

    --
    - Robert

    Ohloh profile for Robert Burkhead

    Stack Overflow profile for RobertB at Stack Overflow, Q&A for professional and enthusiast programmers
  • Do you have access to the Apache conf directory? Can you edit the httpd.conf and extras/vhosts.conf? If you have control over the server, you might be able to set up what you need with named virtual hosts instead of mod_rewrite. That would solve the problem for you.

    If you're on a hosting provider's box, then that option won't work since they'll likely not give you that level of access.

    --edit--

    As a side note, the way I eventually solved the issue I had was to stop doing it altogether. Part of the reason I had the subdirectories and mod_rewrite was to maintain a test version of the site because I did not have a computer locally that I could set up as a test server. I have long since replaced my old Model-T hand-crank computer with a more modern one, and moved my test installation to my local box using a wamp stack.



    Edited by rmburkhead on Sep 01, 2010 - 12:39 AM.

    --
    - Robert

    Ohloh profile for Robert Burkhead

    Stack Overflow profile for RobertB at Stack Overflow, Q&A for professional and enthusiast programmers
  • I don't have access to httpd.conf or vhosts.conf. I'm not using shorturls, so I'll opt for that solution for now, it sounds like the best option for me ATM.

    Hmm, doesn't seem to work..
    Either something has changed since you posted the possible solution or I've done something wrong icon_frown



    Edited by maverick on Aug 31, 2010 - 07:59 PM.
  • Which solution did you try? There are several.

    --
    - Robert

    Ohloh profile for Robert Burkhead

    Stack Overflow profile for RobertB at Stack Overflow, Q&A for professional and enthusiast programmers
  • rmburkhead

    Which solution did you try? There are several.


    Proposed alternate solution:

    1. In config/config.php, after line 42, which reads:

    $PNConfig['System']['development'] = 0; // should be set to 0/false when cutting a release for production use

    add the following:

    $PNConfig['System']['uriHiddenPath'] = ''; // should be empty, unless mod_rewrite (or some other similar facility)
    // is used to hide an intermediate physical path from the URL through
    // URL rewriting.

    2. It is assumed that if a site needs this functionality, that either (a) an option to set this configuration option will be given at install and/or within the admin UI, or (b) that they will create config/personal_config.php (assuming it is not going away, and that this is an appropriate use) and add the equivalent to the line above with the appropriate preamble to the URI to be removed, e.g.:

    $PNConfig['System']['uriHiddenPath'] = '/this/path/is/hidden';

    3. In includes/pnAPI.php, in the pnGetBaseURI() function, after line 955, which reads:

    $path = str_replace(strrchr($path, '/'), '', $path);

    add the following:

    // Handle hidden intermediate physical paths
    global $PNConfig;
    $hiddenPath = $PNConfig['System']['uriHiddenPath'];
    if (!empty($hiddenPath)) {
    $hiddenPath = preg_quote($hiddenPath, '#');
    $path = preg_replace("#^$hiddenPath#", '', $path, 1);
    }

    Basically what the above does is remove an administrator-supplied string from the front of the path returned by pnServerGetVar('SCRIPT_NAME'). For example, if the web site "www.example.com" is stored in public_html/hiddenDirectory/, then pnServerGetVar('SCRIPT_NAME') would return "/hiddenDirectory". If $PNConfig['System']['uriHiddenPath'] contains "/hiddenDirectory", then after the above, the pnGetBaseURI() would correctly be an empty string, and pnGetBaseURL() would correctly return "http://www.example.com/".

    Pros: It's simple, configurable. It should not affect shortURL schemes. It should work on IIS, since it does not need REQUEST_URI. Using mod_rewrite to hide directories is probably uncommon, so working hard on an "elegant solution" is probably not being very efficient.

    Cons: It's a manual solution, not "automagic"--if the server's physical or logical configuration changes, the administrator has to be sure to change this configuration in Zikula. It's error prone--fat fingers (like mine) will introduce typos in the hidden path typed in by the administrator. Only works if the directory(ies) hidden are on the front part of the URI. It's hard to explain on a page in the installation or configuration process if the administrator does not know what the heck mod_rewrite is, or that it can be used to hide directories from the URL.
  • In the end, the change to the function between PN .76 and Zikula was put in place because of a shortcoming in Microsoft IIS.

    You might want to go back to the very first attachment I made to #864, and give that a try. Since you are not on an IIS installation, you can even delete that stuff.

    By the way, now that I am part of the core developers for Zikula, I should mention that I in no way encourage you to hack the core. icon_smile

    Check your private messages, I'll leave my IM info there for you.

    --
    - Robert

    Ohloh profile for Robert Burkhead

    Stack Overflow profile for RobertB at Stack Overflow, Q&A for professional and enthusiast programmers
  • Microsoft IIS has a shortcoming? NO WAY!?
    Its bad when even Microsoft uses Apache for some of their setups....lol

    Okay, I'm choosing to attempt hacking the core out of a need, nothing more icon_smile
    Thanks for your help.
  • 0 users

This list is based on users active over the last 60 minutes.