• Resolved Robert Ehrenleitner

    (@robertehrenleitnerplus)


    Hello,

    In the file ./app/Common/Traits/Helpers/WpUri.php, there is a function called getSiteUrl within the trait WpUri. In our QA and productive environments, this function returns perfectly fine the site URL.

    However, on my local machine, my development environment is located in my home directory, like $HOME/public_html/wp, which in turn means that my site URL looks like http://localhost/$USERNAME/wp. Note how the subdirectory is part of the site URL. The function getSiteUrl misses this subdirectory completely. I also noticed that the function would miss if the the site was installed to a non-well-known TCP port.

    This bug especially renders the file robots.txt to be not working on my development environment. Instead, the 404 Not Found page is returned. Since this function returns the correct value if the site URL does not have subdirectory, the file robots.txt is working on such installations (like our QA and productive environments).

    I am looking forward to see a fix for this.

    Kind regards,
    Robert

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Prabhat

    (@prabhatrai)

    Hey @robertehrenleitnerplus,

    Thanks for reaching out, and I apologize for the inconvenience caused!

    Could you please share some more details and a screen recording of the issue so I can start my investigation?

    You may use a tool like Loom (https://www.loom.com/screen-recorder) to create the screen recording and share the generated link.

    Also, do you have a physical Robots.txt file or you’re using the default Robots.txt of WordPress?

    I’m looking forward to helping you.

    Thanks!

    Thread Starter Robert Ehrenleitner

    (@robertehrenleitnerplus)

    Sorry, I just noticed that this function is not even invoked. I also see that the filter function to robots_txt as implemented in ./app/Common/Traits/Helpers/Vue.php is not triggered – either because the filter is not triggered at all, or the callback is not hooked.

    Furtheron, I noticed that in the WordPress backend, when I go to the AIOSEO settings to the Robots.txt settings, there is a banner that says:

    It looks like you are missing the proper rewrite rules for the robots.txt file. It appears that your server is running on Apache, so the fix should be as simple as checking the correct .htaccess implementation on ww.wp.xz.cn.

    This message only appears on my development environment. Sure, I have the Apache webserver running and I have an .htaccess file, but I wonder what this file is missing if everything else is running fine. This is my .htaccess file:

    # BEGIN WordPress
    # Die Anweisungen (Zeilen) zwischen „BEGIN WordPress“ und „END WordPress“ sind
    # dynamisch generiert und sollten nur über WordPress-Filter geändert werden.
    # Alle Änderungen an den Anweisungen zwischen diesen Markierungen werden überschrieben.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /~myuser/wp/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /~myuser/wp/index.php [L]
    </IfModule>
    
    # END WordPress
    

    Kind regards

    Plugin Support Prabhat

    (@prabhatrai)

    Hey @robertehrenleitnerplus,

    Could you please share your website’s URL so I can take a look?

    With that said, it’s important to note that All in One SEO doesn’t generate its own Robots.txt. As you indicated, we use the robots_txt filter (https://developer.ww.wp.xz.cn/reference/hooks/robots_txt/) of WordPress to tap into the default robots.txt created by WordPress.

    When you use the Robots.txt feature in All in One SEO, you’re modifying the default robots.txt created by WordPress.

    The reason you’re facing this issue is that your server configuration is missing the proper rewrite rules required by your WordPress site to generate a robots.txt file.

    So if you see a 404 error for robots.txt, then it means your WordPress site itself cannot generate a robots.txt on the URL /robots.txt.

    You can reach out to your hosting provider regarding this and let them know that your server is missing proper re-write rules and WordPress cannot generate the robots.txt for your site on the URL /robots.txt, and they should be able to fix the rewrite rules for you.

    Please feel free to let me know if you have any questions.

    Thanks!

    Thread Starter Robert Ehrenleitner

    (@robertehrenleitnerplus)

    Sorry, your answer is quite useless. Please read my question more thoroghly. This is a problem which occurs on my local machine only. Nevertheless, I am sysadmin on my local development system, the QA system and the productive system – there is no one else who can do that instead of me.

    Kind regards.

    Plugin Support Prabhat

    (@prabhatrai)

    Hey @robertehrenleitnerplus,

    I apologize if my last reply wasn’t helpful!

    However, if the Robots.txt is returning a 404 on your local site, the issue is likely related to your WordPress installation/rewrite rules itself since All in One SEO doesn’t generate the Robots.txt – As mentioned in my previous reply, we only tap into the Robots.txt generated by WordPress itself.

    With that said, can you temporarily disable All in One SEO on your local site and see if the Robots.txt works? If not, this would confirm that the issue isn’t coming from All in One SEO.

    Please let me know how that goes.

    Thanks!

    Plugin Support Prabhat

    (@prabhatrai)

    Hey @robertehrenleitnerplus,

    We haven’t heard back from you in a couple of days. I’m going to go ahead and close this thread for now. But if you’d like us to assist, please feel welcome to continue the conversation.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Wrong site URL’ is closed to new replies.