1 2 Previous Next 22 Replies Latest reply on May 4, 2016 12:07 PM by macrec

    Redirect IWP calls to WebDirect calls using Apache ?

    Fred(CH)

      Hello there,

       

      After a bit of searching, i was not able to accomplish this…

       

      If i want to replace a FileMaker IWP server by a FileMaker WebDirect server, i have to replace all old links to the newer; i will have of course regular web pages to update but also FileMaker databases which actually store old iwp url's.

       

      However, i have a lot instances to update, and for more smoothly transition, i was wondering if it would be possible to use alias or redirection modules of Apache, and given that FileMaker 14 install its own instance of apache, you cannot use OS X Server interface. Since i am not familiar with apache commands in Terminal i would not loose a lot of time on this particularly if an expert call it definitely impossible ?!

       

      In essence, i would like convert automatically calls like :

      http://www.mywebserver.com/fmi/iwp/cgi?-db=MyPublicDatabase

      to

      http://www.mywebserver.com/fmi/webd#MyPublicDatabase

       

      Any idea?

      Thanks...

       

      Fred

        • 2. Re: Redirect IWP calls to WebDirect calls using Apache ?
          Fred(CH)

          Thank you very much sounds gooood !

           

          I will try this, but sounds like i have too much lacks in this kind of work using the terminal . I will go back to school first and will keep you posted if i am able to produce something. Very interesting and refreshing though.

           

          Fred

          • 3. Re: Redirect IWP calls to WebDirect calls using Apache ?
            mdiehr

            The hardest part is figuring out how to enable mod_rewrite and where to put the command, but once you do it's probably a one-line fix.

             

            Are you familiar with .htaccess files?  These allow you to have custom apache configurations that apply only to a single folder and its children.   I find that's often a good place to put these sorts of modifiers.

            • 4. Re: Redirect IWP calls to WebDirect calls using Apache ?
              Fred(CH)

              I can confirm that mod_rewrite is loaded on my dev server since it appears when i query for the list of loaded modules, but i am indeed now documenting on where/how put the command; because no, i am not familiar at all with .htaccess files and, more generally, my use of terminal app is actually less than very basic.

               

              Fortunately, there a lot of great tutorials about it out there; the real difficulty i have is the time shortage compared to the amount of knowledge to acquire, but well, i am a patient and interested guy .

              • 5. Re: Redirect IWP calls to WebDirect calls using Apache ?
                Fred(CH)

                Oh and also, i was able to ensure me the httpd.conf located on /Library/FileMaker Server/HTTPServer/conf/ have this line on it (without any leading #):

                LoadModule rewrite_module /usr/libexec/apache2/mod_rewrite.so

                then, i also found :

                # Rewrite settings

                Include conf/extra/httpd-rewrite.conf

                 

                I finally noticed that this folder contained two others similar files  : "httpd.conf.2.2" and "httpd.conf.2.4", where the exact same occurrences of mod_rewrite are found...

                 

                So, you now know exactly where i am .

                • 6. Re: Redirect IWP calls to WebDirect calls using Apache ?
                  Fred(CH)

                  I am still searching... After more documenting i now more understand what i have to do (i hope).

                   

                  I modified httpd.conf files as following in order to allow recognition of .htaccess file :

                   

                  <Directory "${HTTP_ROOT}/htdocs">

                    #  AllowOverride None

                  AllowOverride FileInfo

                   

                  PS : i discovered that "httpd.conf.2.2" was a hardlink to the original "httpd.conf", whereas "httpd.conf.2.4" was a kinda duplicate file.

                   

                  Performed a restart in the terminal :

                   

                  sudo launchctl stop com.filemaker.fms

                  sudo launchctl start com.filemaker.fms

                   

                  I created an .htaccess file and put it in the root of fms apache :

                  /Library/FileMaker Server/HTTPServer/htdocs

                   

                  But i now have a strange behavior; Whatever the rewriterule i put on this file, the result is alway the same :

                  Forbidden access : [403] error.

                   

                  Even when it is to not modify anything :

                    RewriteEngine on

                    RewriteRule .* -


                  EDIT : to be more accurate, the 403 appears if i access for instance with url like <ip adress> or <ip adress>/index.html whereas if i remove or put in comment the two line on the htaccess file, i can access to index.html via both urls.

                   

                  However, an url like  <ip adress>/fmi/webd will bring me to the webdirect homepage whereas <ip adress>/fmi/iwp will display the error from WebDirect saying that "page not fount please use a valid WebDirect URL", regardless of the content htaccessfile.

                   

                  That lead me to think that maybe htaccess file configuration is located in the wrong place OR is not a valid approach to be used with FileMaker WebDirect.

                  • 7. Re: Redirect IWP calls to WebDirect calls using Apache ?
                    user19752

                    If you have full control on the server, it may be easier editting conf/extra/httpd-rewrite.conf

                    itself.

                    • 8. Re: Redirect IWP calls to WebDirect calls using Apache ?
                      Fred(CH)

                      Thanks to your input, i was able to go one step forward !!!

                       

                       

                      I am now testing how to formulate correct substitution's url for the last part (parameter) :

                      #MyPublicDatabase

                      ...which is still a problem for me, and it is obviously due to my lack of knowledge about syntax and others regex .

                       

                      But as far, actual results are yet really exciting. Thank you both for your help. Will keep you posted.

                       

                      Bye, Fred

                      • 9. Re: Redirect IWP calls to WebDirect calls using Apache ?
                        user19752

                        How about

                        RewriteRule ^/fmi/iwp/cgi?-db=(.+) /fmi/webd#$1

                        • 10. Re: Redirect IWP calls to WebDirect calls using Apache ?
                          Fred(CH)

                          Great thanks user19752. Sounds good syntax to capture and transform parameter.

                           

                          Unfortunately, that does not work actually.

                           

                          About the pattern to match, since i go farther than cgi? not any substitution occurs anymore.


                          Additionally, don't know why, but in order to have satisfying results, i have to start the substitution string by http://%{SERVER_NAME}.


                          These are examples assuming the incoming URI is <ServerIPAdresse>/fmi/iwp/cgi?-db=<MyDatabase>


                          Pattern to matchSubstitution Result
                          ^/fmi/iwp/cgi?-db=(.+) /fmi/webd#$1WebDirect URL Error
                          ^/fmi/iwp/? /fmi/webd404 object not found
                          ^/fmi/iwp/? http://%{SERVER_NAME}/fmi/webdWebDirect homepage
                          ^/fmi/iwp/cgi?http://%{SERVER_NAME}/fmi/webdWebDirect homepage
                          ^/fmi/iwp/cgi?-db=(.+) http://%{SERVER_NAME}/fmi/webd#$1WebDirect URL Error


                          user19752 a écrit:

                           

                          How about

                          RewriteRule ^/fmi/iwp/cgi?-db=(.+) /fmi/webd#$1

                          • 11. Re: Redirect IWP calls to WebDirect calls using Apache ?
                            user19752

                            Ouch. I forgot "?" is a special char in regex, should be escaped by backslash.

                             

                            ^/fmi/iwp/cgi\?-db=(.+) /fmi/webd#$1

                            I hope minus and sharp are not special

                            • 12. Re: Redirect IWP calls to WebDirect calls using Apache ?
                              Fred(CH)

                              Think i tried yet to escape ? (i did a lot more tests than above before posting) but i will try again. Big thanks !

                              • 13. Re: Redirect IWP calls to WebDirect calls using Apache ?
                                Fred(CH)

                                Negative : result is webdirect url error.

                                And what about the Hashtag in /fmi/webd#$1

                                Isn't it processed as a comment ?

                                Thus, i also tried/fmi/webd\#$1


                                All new attempts below were resulting in the same WebDirect URL error:

                                RewriteRule ^/fmi/iwp/cgi\?-db=(.+) /fmi/webd#$1

                                RewriteRule ^/fmi/iwp/cgi\?-db=(.+) /fmi/webd\#$1

                                RewriteRule ^/fmi/iwp/cgi\?-db=(.+) http://%{SERVER_NAME}/fmi/webd#$1

                                RewriteRule ^/fmi/iwp/cgi\?-db=(.+) http://%{SERVER_NAME}/fmi/webd\#$1

                                 

                                That generally means that not any substitution were made, since all incoming incoming URI that have /fmi prefix is going by default to WebDirect engine.

                                • 14. Re: Redirect IWP calls to WebDirect calls using Apache ?
                                  user19752

                                  comment!

                                   

                                  I saw the table in the bottom of document, but examples prior are quoted. then

                                  RewriteRule "^/fmi/iwp/cgi\?-db=(.+)" "/fmi/webd#$1"

                                  1 2 Previous Next