We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10746
    • 126 Posts
    I’ve been trying and failing to get friendly URLs to work... I have read the Wiki Friendly URL guide, but still can’t seem to get it right...

    Here is my set-up... it is a university department with an Apache server for a number of individual staff member’s websites.

    The actual physical location of the files for each person is

    /home/www/DOCS/people/<name>

    where <name> is a (Unix "ln") link to a location on the disk server.

    In my particular area, I have located MODx at the top level ... thus

    /home/www/DOCS/people/gordon/assets

    is one way of getting to the assets directory.


    The URL that is used to access these things is

    http://www.csse.uwa.edu.au/~gordon
    OR
    http://people.csse.uwa.edu.au/gordon

    which jumps directly to "index.php" and so on.


    So what is the RewriteBase? I think that "/home/www/DOCS" is the Apache root so I tried using "people/gordon" as the RewriteBase, but no dice...

    In fact, I have tried pretty much every combination that I can think of for the RewriteBase and for the RewriteRule...

    On *SOME* combinations, I manage to produce an error/warning from the web server

    "mod_rewrite’s internal redirect status : 0/10"

    but it doesn’t seem to do anything...


    Help greatly appreciated...

    Gordon


      • 22303 MODX Staff
      • 10,725 Posts
      Apache should be taking care of the base location for each person, so the default values in htaccess should work; i.e. something like this...

      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
        • 10746
        • 126 Posts
        Well, the defaults didn’t work...

        The GOOD NEWS is that I stumbled across a combination that DID work...

        RewriteBase: /gordon
        RewriteRule: ^(.*)$ /gordon/index.php?q=$1 [L,QSA]

        This is using the "people.csse.uwa.edu.au" URL which has a different "site root" from the other URL.

        The BAD NEWS is that everything else broke...

        - most of it could be fixed by replacing everything in the template and other files that referred to

        assets/templates
        assets/snippets
        assets/galleries

        etc

        with

        [(base_url)]/assets/snippets
        [(base_url)]/assets/templates

        and so on.


        BUT one important remaining thing simply does not work... [~[*id*]~]

        Whenever I include that in a sub-folder then the URL that is generated gets the "head" of the sub-folder generated twice...

        So if I have a structure with a document with alias "admin" containing a document with alias "test" then the link that is generated is

        admin/admin/test.html

        I have set "use friendly alias paths" as instructed in the Wiki...

        Cheers

        Gordon
          • 10746
          • 126 Posts
          Quote from: gfroyle at Dec 04, 2006, 01:16 AM


          I have set "use friendly alias paths" as instructed in the Wiki...


          More good news... after re-reading three hundred forum posts and typing "Friendly URL wrong path" into the search box about five times, I discovered that I need to include

          <base href="[(site_url)]" />

          into the HEAD element of my template AS WELL as all the other stuff... (I first thought that this was a fix for an earlier version of MODx, not the current situation).



          My question is: should the Wiki mention this in its section on friendly alias paths?

          My second question is: should *I* just add it to the Wiki?

          (I am not used to the Wiki style of collaborative editing, and always feel that the original author might be miffed if I randomly edit their work, possibly introducing errors... just need to know the accepted "wiki-quette")

          But, hooray, it all works now..

          Gordon

          EDIT: Added clarifying remark to Wiki about where to locate the tag, and why it is important.
            • 22303 MODX Staff
            • 10,725 Posts
            Your patience, diligence, and willingness to contribute back what you are learning here is duly noted and appreciated Gordon. And don’t feel your efforts are wasted; every person that struggles with and works through issues like these helps expose the weak spots in the product and community. Ultimately it will make MODx that much better...
            wink