We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18835
    • 41 Posts
    I would love to change the link to my website to complete SEO urls.

    The component i’m working ons works with the next link
    siterurl.ext/readarticle/?article=10486

    I need to change it to
    siterurl.ext/readarticle/article/10486

    How can I do this with htaccess?
    The basic friendly urls is working.
      • 1343 ☆ A M B ☆
      • 2,213 Posts
      You would use something like this:

      RewriteRule ^readarticle/article/([^_]*)$ /index.php?q=readarticle/?article=$1 [L]

      Keep in mind this is untested! It goes just before this htaccess:

      RewriteRule ^(manager|assets) - [L]

      # For Friendly URLs
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 18835
        • 41 Posts
        I don’t have that manager/asset rule

        But if I create this (with or without the manager) all the pages are loading without css style
        Also the readarticle/article/xxxxx is not working and going to the homepage.

        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^readarticle/article/([^_]*)$ /index.php?q=readarticle/?article=$1 [L]
        RewriteRule ^(manager|assets) - [L]
        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
          • 4172
          • 5,888 Posts
          I would try to create a plugin for onPageNotFound.
          example see in this thread: http://modxcms.com/forums/index.php/topic,60689.msg345196.html#msg345196
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 1343 ☆ A M B ☆
            • 2,213 Posts
            It looks like you have things out of order, you are looking for something like this:

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


            Look for the comment "# For Friendly URLs" in your htaccess code and place my line directly above it. I can take a closer look if you are still having issues.
              Patrick | Server Wrangler
              About Me: Website | Tweets |  MODX Hosting