We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44963
    • 16 Posts
    I moved a previous site into ModX and am really enjoying the functionality and ease of use.

    Here's a small issue. Our software has a piece of code that refers users out to a .php page on our site. I can't change the link in the software (well, I probably will for the next release but in the meantime the link needs to work). How do I tell ModX to name a page ____.php? I don't want to use redirects because the link from the software is also passing in a couple of pieces of data that I need to preserve.

    Thanks for any help you can offer?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Perhaps use a snippet that includes your .php file? If it's a stand-alone page, then use a weblink that links to yourfile.php, and include a link back to the site in your .php page.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 39404
        • 175 Posts
        stalemate resolution associate Reply #3, 13 years ago
        Another option might be to add a rewrite rule to take any .php file and rewrite it to .html.

        Options +Indexes
        Options +FollowSymlinks
        RewriteEngine on
        RewriteBase /
        RewriteRule ^([^.]+)\.html$ $1.php [L]
        


        or

        RewriteEngine on
        RewriteBase /
        RewriteRule ^(.*)\.php$ $1.html [R=permanent] 
        


        As Susan said, if it's just a standalone page, the weblink might be a better approach.
          • 28120
          • 380 Posts
          I thought that was what Content Types were for?

          I just created a new System -> Content Type

          PHP
          Mime Type = text/html
          File Extension = .php

          then set a resource to that and it then runs as .php
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Did that actually work?
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 28120
              • 380 Posts
              Yes, just tried it.
                • 44963
                • 16 Posts
                Thanks! I think Sparky's suggestion will do exactly what I need. Appreciate the help -- good community here.
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  @sparky - Can you describe the resource? What type of resource? Does it have a snippet that includes the external .php file?
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 28120
                    • 380 Posts
                    It's just a regular resource. What you then put in it, snippets/chunks, is up to you.

                    All my solution offered was for the url to end in .php.

                    It didn't change the processing of the Resource.
                      • 9995
                      • 1,613 Posts
                      Doesn't this work, see attach

                      change .html to .php ?

                        Evolution user, I like the back-end speed and simplicity smiley