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

    I need some help with rewrite / FURL, I actived this in the modx manager and work correct.
    However I also work with some snippets with data from mysql database.

    This will call pages like this:
    index.php?id=6&cat=news&page=2
    index.php?id=6&cat=news&item=2010

    The rewrite at this point will show the pages like (where the news.html comes from modx index.php?id=6):
    news.html?cat=News&srch=&page=2
    newsitem.html?cat=News&item=2010

    But I want it to show like this:
    mywebsite.com/news/page2/
    mywebsite.com/news/2010/

    Tried this lines and even a rewrite generator, but no result

    #RewriteRule ^(.*)/(.*)/(.*)/$ index.php?id=$1&cat=$2&item=$3 [QSA]
    #RewriteRule ^(.*)/(.*)/$ index.php?id=$1&cat=$2 [QSA]

    #RewriteRule ^(.*)/$ index.php?id=$1 [QSA]
    #RewriteRule ^news/(.*)/(.*)$ news.html?cat=$1&page=$2 [QSA]

    Can somebody help me.
    hathor
      • 2912
      • 315 Posts
      The following rewrite rule is used in the FileDownload Plugin. It may offer some help. I’m no good with rewrite rules myself:

      RewriteRule ^([^/]*)/?(.*)$ index.php?q=$1&d=$2 [L,QSA,NC]

      The above rule works on passing the modx document as q that follows the root folder and anything after the first / as d.

      ie:
      http://mysite.com/downloads/myfile.txt = index.php?q=downloads&q=myfile.txt
      http://mysite.com/downloads/test/myfile.txt = index.php?q=downloads&q=test/myfile.txt

      Like I said I’m no good at rewrites so I wouldn’t know where to start to break it down further but I’m hoping it gives you some kind of help.

      You may have to be even more careful if you are using FURL’s with alias paths (parent/childs).
        BBloke