New Community Forums are coming. Watch this space for news.
Subscribe: RSS
  • Hello, if my website tree is too deep, how can i limit this behavior?

    For example, having a tree like this:

    Root
    Categories
    ------subcategories
    ----------subsubcategories
    --------------Article1.html
    --------------Article2.html
    --------------ArticleETC.html

    My url is becoming too long root/Categories/subcategories/subsubcategories/Article1.html so my SEO is gonna suffer

    how can i change the url without moving my articles 2 levels less deep? like:
    root/Categories/Article1.html

    (NOTE: if succeded, i think i have to do redirects because those deep url no longer exists for Google...)

    i certainly dont want to move all my articles manually, because in the future, that would be a pain in the 4SS :/

    Thanks

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

    • I think this works with Friendly URLs and as you said htaccess re-writing. Did you turn FriendlyURLs on?

      You can use a re-write rule to completely eliminate a folder.

      For menus, eliminate folder levels from the menu by choosing the parent, and for each resource you can hide it from menus directly.
      • Quote from: nuan88 at Aug 28, 2018, 04:44 PM
        I think this works with Friendly URLs and as you said htaccess re-writing. Did you turn FriendlyURLs on?

        You can use a re-write rule to completely eliminate a folder.

        I dont know how to do that, and i think its to risky if it fails(dont have ftp so i cant backup and restore the file if failed) XD

        i tried the URL freeze(it works doing this), changing the url here will change the url without phisically changing manually the resource. but then i need redirects since the url freeze is changing my url as expected.

        How can i do redirects from url to new url? using database table?

        Thanks
        • Quote from: jacielluve at Aug 28, 2018, 06:02 PM
          Quote from: nuan88 at Aug 28, 2018, 04:44 PM


          How can i do redirects from url to new url? using database table?

          Maybe this component will help: https://docs.modx.com/extras/revo/redirector
            Anton Tarasov
            MODX Developer

            Email: contact@antontarasov.com
            Web: antontarasov.com
          • Quote from: jacielluve at Aug 28, 2018, 06:02 PM
            Quote from: nuan88 at Aug 28, 2018, 04:44 PM
            I think this works with Friendly URLs and as you said htaccess re-writing. Did you turn FriendlyURLs on?

            You can use a re-write rule to completely eliminate a folder.

            I dont know how to do that, and i think its to risky if it fails(dont have ftp so i cant backup and restore the file if failed) XD

            i tried the URL freeze(it works doing this), changing the url here will change the url without phisically changing manually the resource. but then i need redirects since the url freeze is changing my url as expected.

            How can i do redirects from url to new url? using database table?

            Thanks

            It is daunting but you should be able to log into your account with your hoster and download the old file and upload the new. I also can't ftp very well.
            • Quote from: nuan88 at Aug 28, 2018, 04:44 PM
              I think this works with Friendly URLs and as you said htaccess re-writing. Did you turn FriendlyURLs on?

              You can use a re-write rule to completely eliminate a folder.


              yes, i have friendly url.

              ill try the rewrite rule as suggested. do you have any example for removing folder from my url.

              ill try to test it in a new locally modx install, so i can change files directly XD
              • discuss.answer
                I think this code will work, right under the rewrite/on beginning of the htaccess file

                RewriteCond %{DOCUMENT_ROOT}/Folder/login/$1.php -f
                RewriteRule ^([\w-]+)/?$ Folder/login/$1.php [L]


                I think we just had this issue a couple weeks ago but I can't find it.

                Save the original file just in case! Be careful!