Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-136108

URLs using a virtual host are always reformatted on export and import, even in cases where they don't need to be

Details

    Description

      Description
      When using a virtual host, URLs don't have to include the servlet mapping or the site friendly URL; they can simply include the page friendly URL.

      However, when such a URL is exported and imported into a different site, it is always modified to include the servlet mapping and the site friendly URL, even in cases where it doesn't need to be (e.g. the import site also has a virtual host of its own).

      Steps to Reproduce
      1. Add the following lines to your hosts file and save:

      127.0.0.1   test.one
      127.0.0.1   test.two
      

      1. Navigate to Control Panel > Sites.
      2. Create a new Site named "S1".
      3. In S1, navigate to Configuration > Site Settings > Site Configuration (under "Platform") > Site URL.
      4. Set the Public Pages Virtual Host URL to "test.one" (Use the Default Language). Click the Save button.
      5. In S1, navigate to Site Builder > Pages > New > Public Page > Widget Page.
      6. Name the page "Test Page" and click the "Add" button.
      7. Verify that the Friendly URL of the created "Test Page" is "/test-page". If it is not, please change it to "/test-page".
      8. In S1, navigate to Content & Data > Web Content > + > Basic Web Content.
      9. Give it the title "Test Content".
      10. Switch to the "Source" view and paste the following into the text box:

      <p><a href="http://test.one:8080/test-page">Test Page</a></p>
      

      11. Click the "Publish" button to publish "Test Content".
      12. In S1, navigate to Publishing > Export.
      13. Leave all the configuration options as default, and click on the "Export" button to export the site.
      14. Download the resulting LAR file.
      15. Navigate to Control Panel > Sites.
      16. Create a new Site named "S2".
      17. In S2, navigate to Configuration > Site Settings > Site Configuration (under "Platform") > Site URL.
      18. Set the Public Pages Virtual Host URL to "test.two" (Use the Default Language). Click the Save button.
      19. In S2, navigate to Publishing > Import.
      20. Import the LAR file that you downloaded in step 14 (Leave all options as the default).
      21. In S2, navigate to Content & Data > Web Content.
      22. Edit "Test Content" and click on the Source view. Observe the URL in the text box.
      Expected Result: The URL would be "http://test.two:8080/test-page" since that mimics the format that the URL was in when it was exported.
      Actual Result: The URL is "http://test.two:8080/web/s2/test-page". "/web/s2" has been appended to the URL even though the equivalent "/web/s1" was not in the exported URL.

      Note that the URLs in the expected and actual result both point to the same page, so this is more of a cosmetic issue than anything else.

      Note that, if we omit steps 17-18 (i.e. we do NOT set a virtual host for S2), then the "Actual Result" would actually be the correct behavior. This is because the URL "http://test.two:8080/test-page" won't work unless if S2 has a virtual host of "test.two". We would need to append the "/web/s2" for the URL to work in that case. So, we need to check on the import site to see whether or not we can retain the format of the URL that was used on export.

      Attachments

        Activity

          People

            joyce.wang Joyce Wang
            michael.bowerman Michael Bowerman
            Kiyoshi Lee Kiyoshi Lee
            Michael Bowerman Michael Bowerman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              1 year, 22 weeks, 6 days ago

              Packages

                Version Package
                7.2.10 DXP FP15
                7.2.X
                7.3.10.3 DXP SP3
                7.3.X
                7.4.13 DXP GA1
                7.4.3.4 CE GA4
                Master