We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38206
    • 2 Posts
    Hi

    I have a question regarding redirecting the html in modx into an url

    I created a folder (named folder1) and saved it on the webserver and created an html (named myfile.html) and saved it on the folder1.

    Now if I go to www.mysite.com/myfile, the myfile.html will open.

    What I would like to do is to redirect this myfile.html to a certain url that belongs on the site. How should I do that?

    Btw, here is the code I wrote in the myfile.html file:

    <html>
    CONSTRUCTION – this page will provide the online documentation
    </html>


    and I would like that www.mysite.com/myfile

    will open this content from my site
    content1

    Please help thanks
      • 3109 ☆ A M B ☆
      • 894 Posts
      You can use the MODX extra Redirector, although that's not what it was built for, you could also do it with javascript.

      Hope that helps.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 32316
        • 387 Posts
        Btw, here is the code I wrote in the myfile.html file:
        BTW you need to use the code tags if you want anyone to see your code.

        I'm not sure I follow what you are trying to do - perhaps it would clearer with the missing code since if all you want to do is to have content1 be displayed with the www.mysite.com/myfile url you just need to make 'myfile' the content1 resource alias - that seems so obvious that I think I'm mis-understanding!
          • 3749
          • 24,544 Posts
          Depending on what's in the mysterious 'myfile', you might also be able to use a simple redirect in the .htaccess file. Something like this:

          RewriteCond %{QUERY_STRING}  ^$
          RewriteRule ^myfile content1? [R=301,NE,L]
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting