This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 3 replies, has 3 voices.
Last updated by Dražen 3 years, 6 months ago.
Assisted by: Dražen.
Author | Posts |
---|---|
December 6, 2021 at 3:46 pm #10134771 | |
cornelisB |
Hello! I'm trying to set up a robots.txt file for every different domain on our website, which consists of a main website and 4 translations. Every domain is an unique one for 5 different countries, EN, NL, DE, FR and IT. I found the following two methods as a solution for similar questions about this topic in the past: ---------------------------------------------------------------------------------- # Seperate robots.txt for each individual domain # BEGIN WordPress #EN #NL #DE #FR #IT RewriteBase / <IfModule mod_security.c> ----------------- #After that create and edit individual robots txt for each domain, using the file names as referred in .htaccess: robots-en.txt ---------------------------------------------------------------------------------- RewriteCond %{HTTP_HOST} ^www.uniquedomain1.eu [NC] RewriteCond %{HTTP_HOST} ^www.uniquedomain2.nl [NC] RewriteCond %{HTTP_HOST} ^www.uniquedomain3.de [NC] RewriteCond %{HTTP_HOST} ^www.uniquedomain4.fr [NC] RewriteCond %{HTTP_HOST} ^www.uniquedomain5.it [NC] #To prevent WP from rendering a virtual robots.txt: touch robots.txt ----------------- #After that create and edit individual robots txt for each domain, using the file names as referred in .htaccess: robots-en.txt ---------------------------------------------------------------------------------- Can you help me which one is the right method to use? The Google robots.txt-tester returns for both methods only data of the original robots.txt file (which I deleted after generating the 5 seperate robots.txt files). When using method 2, adding the line 'touch robots.txt' results in a '500 Internal Server Error' (see attachment) when visiting the website. When this line is deleted the server error disappears. Thanks! |
December 6, 2021 at 3:57 pm #10134807 | |
Alejandro WPML Supporter since 02/2018
Languages: English (English ) Spanish (Español ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
Hello, I'm alejandro and i'll help you while a supporter takes your case. What you're asking falls under the "custom coding" category, since it's a custom solution that fits your needs, and it's out of the scope of our support. Having said this, my personal opinion would point me to the second method but the error is probably something that you should ask in the place where you saw/copy the code from. Regards. |
December 6, 2021 at 4:13 pm #10134881 | |
cornelisB |
Hello, it comes from your own website: https://wpml.org/forums/topic/define-individual-robots-txt-for-specific-domains/ Is it possible to let someone else take a look at it? Thanks. |
December 8, 2021 at 8:27 am #10144611 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello, thanks for getting back. As my colleague said, when it comes to custom work solutions, we can advise and point you in the correct direction, but we can not debug or do further custom work for you. The suggested solution from a ticket is provided by the client and it should work, but it could also depend on your server configuration. If it gives a server error, you might want to check with hosting support what is wrong. I suggest you try to set up robots.txt for each individual domain without WPML, and it should work fine also with WPML. Some things don’t fall under our standard support, but they still need doing. You can get excellent work from WPML Contractors. - https://wpml.org/contractors/ Hope I was helpful and you will understand our side here. 🙂 Thanks and kind regards, |