We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53688
    • 12 Posts
    I've read every forum post and help doc I could find and have gotten friendly URLs close to working with one important exception.

    The links created by referencing the id number (href="[[~2]]") try to go to the correct friendly URL - mysite.com/about.html as opposed to the original mysite.com/index.php?id=2. The problem is that the pages do not respond to the friendly URL. What should be the about.html page only displays if you call index.php?id=2. Otherwise, only a 404 is displayed.

    The .htaccess page is edited and at the main level of all my other ModX files, friendly URLs are turned on. Is this something anyone has seen? I'm thinking there's some minor thing I missed, but cannot figure out what that is.

    Thanks in advance.

    This question has been answered by mdhiscock. See the first response.

      • 17301
      • 932 Posts
      Do you have this set as your base href tag in your header?

      <base href="[[!++site_url]]" />


      Does your site exist in a sub folder and if so does your rewrite base reflect this ?
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 53688
        • 12 Posts
        Quote from: lkfranklin at Sep 01, 2017, 10:08 AM
        What do you have set as your base href tag in your header?

        Does your site exist in a sub folder and if so does your rewrite base reflect this ?

        I do have <base href="[[!++site_url]]"> in the head of my template (only have the one template as I'm just starting out and need friendly URLs working or this will be a no-go).

        Site structure is side by side with an existing running site.

        Running - mysite.com/stuff
        ModX - mysite.com/stuff.mike - This is where ModX is installed and where I have the .htaccess file.

        For reference, the .htaccess looks like this:
        **************
        RewriteEngine On
        RewriteBase /stuff.mike

        RewriteCond %{HTTP_HOST} .
        RewriteCond %{HTTP_HOST} !^mysite\.com [NC]
        RewriteRule (.*) http://mysite.com/$1 [R=301,L]

        # The Friendly URLs part
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
        **************

        If I can supply any other info that might help, let me know.
          • 17301
          • 932 Posts
          Try

          RewriteBase /stuff.mike/
            ■ email: [email protected] | ■ website: https://alienbuild.uk

            The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
            • 53688
            • 12 Posts
            Quote from: lkfranklin at Sep 01, 2017, 10:29 AM
            Try

            RewriteBase /stuff.mike/

            Just tried, but no luck.

            Odd thing is, no matter if I have "ReWriteBase /stuff.mike", "ReWriteBase /stuff.mike/" or "ReWriteBase stuff.mike/", the 404 message is always "The requested URL /stuff.mike/about.html was not found on this server." Now I would think that one of those configurations would have the effect of adding a double slash to the URL. What would happen if the .htaccess file wasn't being read at all? And is there a way to check if it is or isn't?
              • 38783
              • 571 Posts
              Is /stuff.mike a valid path?

              I have never seen a 'dot' in this position before, unless mike was a tld, but your tld is .com.

              But I am happy to be corrected!

              Is mike a folder inside stuff or do you have a folder called mike.stuff?

              If you do have a dot in your folder name would you need to put a back slash in front of it within your .htaccess file?

              RewriteBase /stuff\.mike/





                If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

                email: [email protected] | website: https://andytough.com
                • 53688
                • 12 Posts
                Quote from: andytough at Sep 01, 2017, 11:04 AM
                Is /stuff.mike a valid path?

                I have never seen a 'dot' in this position before, unless mike was a tld, but your tld is .com.

                But I am happy to be corrected!

                Is mike a folder inside stuff or do you have a folder called mike.stuff?

                If you do have a dot in your folder name would you need to put a back slash in front of it within your .htaccess file?

                RewriteBase /stuff\.mike/






                It is a valid path. And worked fine as I had the development site there for a while before I decided to try the CMS setup in that location recently. So yes, /stuff.mike is the folder name where everything is housed (developers have done similar here to give each person their own sandbox to work on different server based projects).

                I did try the suggestion of the backslash in .htaccess. It had no effect. But then again, neither does making it stuff.mikex. The link is still trying to go to /stuff.mike/about.html. Which makes me think the .htaccess is not being read at all. Or settings not honored, or something along those lines.

                The .htaccess file is in the same /stuff.mike directory along with index.php and the /assets, /connectors, /core and /manager folders.
                  • 17301
                  • 932 Posts
                  You are clearing your cache both via ftp and in the manager?

                  You could check if the htsccess is being read by setting up a redirect within it.
                    ■ email: [email protected] | ■ website: https://alienbuild.uk

                    The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                    • 3749
                    • 24,544 Posts
                    It /stuff.mike/ is used on the left side of a rewrite rule, the dot would have to be escaped (but not on the right side).
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 18373 ☆ A M B ☆
                      • 3,141 Posts
                      Does your server use Apache? laugh

                      If it's nginx, you'll need to set up the rewrites differently. There's an example for it in the docs.

                      If it is apache, perhaps it's not catching up on the .htaccess in the stuff.mike folder because of a .htaccess higher up in the chain? Maybe a different .htaccess file is already sending requests somewhere else?

                      Can you get to the files if you use the non-friendly-url link? E.g. /stuff.mike/index.php?id=1
                        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.