Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few issues when you use /pub as DocumentRoot #1146

Closed
hostep opened this issue Mar 29, 2015 · 83 comments
Closed

A few issues when you use /pub as DocumentRoot #1146

hostep opened this issue Mar 29, 2015 · 83 comments
Assignees
Labels
Component: Other Component: Sitemap Event: dmcdindia1 Fixed in 2.3.x The issue has been fixed in 2.3 release line help wanted Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@hostep
Copy link
Contributor

hostep commented Mar 29, 2015

Preconditions (*)

Steps to reproduce:

robots.txt

Update: The robots.txt part is no longer valid, was fixed in Magento 2.2.0

sitemap.xml

Steps to reproduce:

  1. Make sure the Magento docroot is set to the pub directory
  2. In the backend, go to Marketing => Site Map
  3. Click 'Add Sitemap' (small inconsistency btw, no space here)
  4. Enter 'sitemap.xml' into the Filename field, enter '/' into the Path field
  5. Click 'Save & generate'

Actual result (*)

Problem: sitemap.xml is created in the Magento root directory and in the column 'Link for Google' it says: http://example.com/sitemap.xml, which is incorrect

Continuing:
6. Click on the sitemap entry in the table
7. Change the Path to '/pub/'
8. Click 'Save & generate'

Problem: sitemap.xml is created in the pub directory, but the column 'Link for Google' now says: http://example.com/pub/sitemap.xml, which is also incorrect

In this case a solution with a redirect/rewrite in the .htaccess/nginx config file isn't really possible as the path and filename of the sitemap are dynamic.

Would be great if Magento (or somebody else) can come up with a way to solve this :)

Thanks!

Expected result (*)

@piotrekkaminski
Copy link
Contributor

@buskamuza is it being addressed?

@gordonknoppe
Copy link
Contributor

+1 this issue needs attention. We should be able to use pub/ to serve from production.

To clarify what I found:

sitemap.xml:

By setting up my sitemap.xml to generate into the pub/ directory I was able to place a file in the sub-directory fine and the resulting XML doesn't have any issues with pub/ in paths the file.

robots.txt:

I see two issues here: Magento will always write to the root folder and there is no way that I can see to change this via configuration. And additionally, if you have set the path of your sitemap.xml to pub/ as above then the robots.txt file created in the root has pub/ in it's "Sitemap: *" path.

@hostep
Copy link
Contributor Author

hostep commented Dec 13, 2015

I just tested this with Magento 2.0.0 GA, and the issues still remain.

robots.txt

Steps to reproduce:

  1. Make sure the Magento docroot is set to the pub directory
  2. In the backend, go to Stores => Configuration => General => Design => Search Engine Robots
  3. Enter something in the Edit custom instruction of robots.txt File field
  4. Save

Problem: the robots.txt file is created in the Magento root directory, not in the pub directory, so it isn't accessible for web requests.

Possible solution for serving Magento from both the root and the pub directory:
Always generate the robots.txt file in the pub directory, and add some line to the .htaccess/nginx config file only in the root directory which redirects you to the robots.txt file in the pub directory when requesting /robots.txt.
Downside: this might confuse shop owners/developers, if they want to add a robots.txt file to the root directory themselves without using the Magento backend, their file won't be used.
What do you think?

sitemap.xml

Steps to reproduce:

  1. Make sure the Magento docroot is set to the pub directory
  2. In the backend, go to Marketing => Site Map
  3. Click 'Add Sitemap' (small inconsistency btw, no space here)
  4. Enter 'sitemap.xml' into the Filename field, enter '/' into the Path field
  5. Click 'Save & generate'

Problem: sitemap.xml is created in the Magento root directory and in the column 'Link for Google' it says: http://example.com/sitemap.xml, which is incorrect

Continuing:
6. Click on the sitemap entry in the table
7. Change the Path to '/pub/'
8. Click 'Save & generate'

Problem: sitemap.xml is created in the pub directory, but the column 'Link for Google' now says: http://example.com/pub/sitemap.xml, which is also incorrect

In this case a solution with a redirect/rewrite in the .htaccess/nginx config file isn't really possible as the path and filename of the sitemap are dynamic.

Would be great if Magento (or somebody else) can come up with a way to solve this :)

Thanks!

@mcspronko
Copy link
Contributor

Hi @tanya-soroka and @piotrekkaminski

Do you guys have any updates for this ticket?

Thanks,
Max

@mcspronko
Copy link
Contributor

Hi @piotrekkaminski

Do you have any update about this bug?

Thanks,
Max

@Marko-M
Copy link
Contributor

Marko-M commented Jun 28, 2016

Luckily you can symlink your way around it, but yep, it's an issue.

@mcspronko
Copy link
Contributor

Hi @Marko-M

Imagine every time marketing department will be asking developer to symlink generated sitemap.xml files :)

@Marko-M
Copy link
Contributor

Marko-M commented Jun 28, 2016

@mcspronko

Yep, an issue.

@mcspronko
Copy link
Contributor

Hi @tanya-soroka

Do you have any update for this issue?
Thanks,
Max

@markalston
Copy link

Still broken in 2.1.0

@atIOCrON
Copy link

I too hoped this would be resolved in 2.1... we need a robots.txt file accessible on the frontend urgently and don't want to mess around with the hacks suggested above.

@hostep
Copy link
Contributor Author

hostep commented Jul 10, 2016

@piotrekkaminski: maybe you should change the label from improvement to bug. I assume it will get picked up earlier if this is tagged as a bug, which it clearly is :)
Also I don't see a MAGETWO- reference number, so this isn't tracked in your internal Jira issues?
I do see a MAGETWO-47607 in #2802 which is related to this issue.

@piotrekkaminski
Copy link
Contributor

I expanded scope of MAGETWO-47607 to include also robots issue.

@mcspronko
Copy link
Contributor

Hi @piotrekkaminski

Any update on this issue?

cc: @pboisvert

@piotrekkaminski
Copy link
Contributor

@mcspronko still in the queue to be fixed.

@mcspronko
Copy link
Contributor

@piotrekkaminski it seems like it is not critical to have proper sitemap.xml and robots.txt files for marketing purposes. Let me fix this issue :), might be faster. So reported 2400 websites will benefit from having proper indexation by search engines.

@piotrekkaminski
Copy link
Contributor

@mcspronko researching why it wasn't included in latest patch. I understand the importance of this issue.

@mcspronko
Copy link
Contributor

Hi @piotrekkaminski

Any luck with findings?

@markalston
Copy link

I was able to workaround this problem by adding symlinks in pub to ../robots.txt and ../sitemap.xml respectively. Seems to work fine.

@liquidia
Copy link

still broken in 2.1.1

@magento-engcom-team
Copy link
Contributor

Hi @limajasachin, here is your Magento instance.
Admin access: https://i-1146-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

@limajasachin
Copy link

This issue is not reproducible.

@limajasachin limajasachin reopened this May 4, 2019
@ghost ghost unassigned limajasachin May 4, 2019
@ghost ghost removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed good first issue Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels May 4, 2019
@limajasachin
Copy link

I am working on this at #dmcdindia19

@michaeldyl520
Copy link

It can still be reproduced on 2.2.6.

@NetStorm84
Copy link
Contributor

@magento give me 2.3-develop instance

@magento-engcom-team
Copy link
Contributor

Hi @NetStorm84. Thank you for your request. I'm working on Magento 2.3-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @NetStorm84, here is your Magento instance.
Admin access: https://i-1146-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

@victortodoran
Copy link

This is still an issue in 2.3.1

@progreg progreg self-assigned this Sep 4, 2019
@m2-assistant
Copy link

m2-assistant bot commented Sep 4, 2019

Hi @progreg. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!


@mcspronko
Copy link
Contributor

Hey, @antonkril is this issue will ever be fixed?
The issue has been opened May 29, 2019, never been fixed and now a Bot requests additional details.

@progreg progreg added Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Component: Sitemap labels Sep 4, 2019
@progreg
Copy link
Contributor

progreg commented Sep 4, 2019

@mcspronko , an issue still reproducible and I have an idea how it can be fixed.

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Sep 4, 2019

Hi @mcspronko @progreg,
This issue actually fixes by adding one line in env.php file.
#1146 (comment)
Also I created issue for documenting it in magento/devdocs#4093, but it still wasn’t done.
I think it’s better to document this option and close this issue, or you prefer better solution?

@Bartlomiejsz
Copy link
Contributor

Bartlomiejsz commented Sep 5, 2019

Hi @ihor-sviziev, sorry to interfere but don't you think it would be good idea to at least add new configuration to installation process that would automatically set this line for new instances?

@progreg
Copy link
Contributor

progreg commented Sep 5, 2019

@ihor-sviziev, Yeap you are right, it will fix the problem. Missed up your comment, thanks for the notice, seems this issue no longer need and it can be closed.

@progreg progreg removed the Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release label Sep 5, 2019
@progreg progreg closed this as completed Sep 5, 2019
@progreg
Copy link
Contributor

progreg commented Sep 5, 2019

@Bartlomiejsz We can open a new issue for this needs as this one have many unneeded details and also touches on Robots module issue that is no longer relevant.

@ihor-sviziev ihor-sviziev added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Other Component: Sitemap Event: dmcdindia1 Fixed in 2.3.x The issue has been fixed in 2.3 release line help wanted Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests