We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2690
    • 148 Posts
    Hello,

    I’m wondering if there is a way to have a different type of friendly urls in modx.
    For example my current url structure is:

    www.name.com/parent1/subparent2/subparent3/pagetitle

    i would love to have it a bit shorter (without changing the actual folder structure), so when somebody types:

    www.name.com/parent1/pagetitle or even: www.name.com/pagetitle

    they get to a needed page...


    Thanks,

    Aleks
      MODx Revo 2.0.6-pl (Traditional) | Apache 2.2.3 | PHP 5.2.14 | MySQL 5.0.77 | MAC OS 10.6.5 | FF 3.6/Chrome 9.0.5
      • 21257 MODX Staff
      • 730 Posts
      If you set "Use friendly alias path" to "No" (in Tools > Configuration > Friendly URLs) then your site will operate with all URLs appearing in the "root" of the site, regardless of the folder structure of your site. However, I recommend you set "Allow duplicate aliases" to "No" and make sure that you do not have any duplicate aliases.
      If you want both (some parts of your site to have a folder structure to the URLs and another part of your site to have shorter root-level URLs) that will be much more complicated.
        Mike Schell
        Lead Developer, MODX Cloud
        Email: [email protected]
        GitHub: https://github.com/netProphET/
        Twitter: @mkschell
        • 2690
        • 148 Posts
        thank you!
        there will definitely be a situation where some pages are named the same (for example for yearly document archives in different folders).


        Would you be able to outline the generic steps in order to make it work for both cases:

        www.name.com/pagetitle

        and

        www.name.com/parent1/pagetitle


        Can i setup somekind of a TV to indicate if this should be a full alias path or a single name page ?

        This is a great help for SEO placements... for example google will rank higher page: www.name.com/sneakers/nike than www.name.com/sneakers/collections/winter07/performance/nike smiley

        Thank you!

        Aleks
          MODx Revo 2.0.6-pl (Traditional) | Apache 2.2.3 | PHP 5.2.14 | MySQL 5.0.77 | MAC OS 10.6.5 | FF 3.6/Chrome 9.0.5
          • 2734
          • 165 Posts
          Well. You could place shortcut rewrite rules in your .htaccess file.
          Eg: your normal URL would look like this
          http://mysite.com/very/long/address/bla
          and in the .htaccess you would rewrite
          http://mysite.com/short to the long address. Thus you’ll have two working URLs, the long one and the "shortcut".
          This could be quite tedious to administrate though. Another possibility would be to automatically generate the .htaccess based on shortcuts that come from a TV or similar. But that is rather risky and you’ll have to be absolutely sure that your .htaccess file wont become corrupted.

          I’d rather go for the "short" url option as described by netProphET. It doesn’t stop you from using the same page titles, you just have to have different page aliases which can even be set manually.. so you could name the alias parent1-pagetitle if you still want to be able to "read" the hierarchy out of the url.
            • 21257 MODX Staff
            • 730 Posts
            Quote from: bakalek at Jan 15, 2008, 02:08 PM

            Would you be able to outline the generic steps in order to make it work for both cases:
            Manually putting rewrite rules as banal suggests is the closest thing to "generic steps" that I can think of.
            I have a hazy vision of being able to accomplish this with a plugin, but there are a lot of things to consider. It would be a bit of a project, but since yours is the second request I’ve read for such a thing, I will start to sketch it out and see if it leads me to a real, possible solution, or to a dead end.
              Mike Schell
              Lead Developer, MODX Cloud
              Email: [email protected]
              GitHub: https://github.com/netProphET/
              Twitter: @mkschell
              • 2690
              • 148 Posts
              Thanks guys!

              After some more thinking i came up with the idea to use ’web links’ for shorter urls.
              It works great when you need to have only 10-50 pages with shorter urls but almost impossible to manage the site with hundreds of pages.

              So, what would be great is to have a checkbox next to the alias filed in the manager which would set the current document’s url to the ’short’ version (meaning - alias only) and automatically create the weblink in the background. Basically each document might have 2 sets of aliases without accessing .htaccess file for every story.
              Am i dreaming?

              Aleks
                MODx Revo 2.0.6-pl (Traditional) | Apache 2.2.3 | PHP 5.2.14 | MySQL 5.0.77 | MAC OS 10.6.5 | FF 3.6/Chrome 9.0.5