Support

Admin Tools

#32792 Non-www to www-URL redirect with a slash too much

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by Kontento on Tuesday, 07 April 2020 05:58 CDT

Kontento
Hi,
I use the htaccess maker and have a problem with the redirect from non-www to www-URL for a specific file.
Google Adsense cannot crawl the ads.txt file in root directory, that leads to revenue loss.
Google support checked it and found, there is a slash too much at the redirect from non-www to https://www.domain.de/ads.txt/
The "/" after ads.txt/ should be removed.

It seems that there is a "/" added at general for all http redirect requests. How is it possible to prevent this or at least for the redirect to ads.txt?

Settings for base directory of the site use / for domain's root (like suggested in admintool documentation)
Redirect code, which is generated by htaccess maker:

##### Redirect index.php to / -- BEGIN
RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteCond %{SERVER_PORT}>s ^(443>(s)|[0-9]+>s)$
RewriteRule ^index\.php$ http%2://www.wunsch-hund.de/ [R=301,L]
##### Redirect index.php to / -- END

##### Redirect non-www to www -- BEGIN
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}>s ^(on>(s)|.*>s)$
RewriteRule ^(.*)$ http%2://www.%{HTTP_HOST}/$1 [R=301,L]
##### Redirect non-www to www -- END

Regards,
Wolfgang

dlb
Wolfgang,

I don't think the trailing slash is the problem. A while back we made a change that requires an exception for any file outside the /media or /images folders that is directly accessed.

In .htaccess Maker, add a line to "Allow direct access to these files". Add
ads.txt
on a new line all by itself. I think that will fix the problem.


Dale L. Brackin
Support Specialist


us.gifEnglish: native


Please keep in mind my timezone and cultural differences when reading my replies. Thank you!


????
My time zone is EST (UTC -5) (click here to see my current time in Philadelphia, PA)

Kontento
Hi Dale,
unfortunately not. I tried this before, the line with ads.txt is added already in "Allow direct access to these files". But without success.
Google support use an internal tool, which shows, what the crawler get from the domain. Currently it is https://www.wunsch-hund.de/ads.txt/

Regards, Wolfgang

nicholas
Akeeba Staff
Manager
Hello Wolf,

I think you are misdiagnosing your issue. Admin Tools' .htaccess Maker has nothing to do with your issue.

Accessing http://wunsch-hund.de/ads.txt redirects correctly to https://www.wunsch-hund.de/ads.txt and the file is readable. Also note that https://wunsch-hund.de/ads.txt does not work because you don't have a TLS certificate that's valid for the non-www subdomain.

That is to say, the non-www to www redirection does NOT add a forward slash. Not only the .htaccess code you pasted proves it, it is easy to verify it by trying to get the non-www URL with your browser, wget, curl or a similar tool.w

Please check whatever it is that tells Google which file to access (most likely your AdSense configuration). That's what is broken. When you're fixing the trailing slash there you should also just tell it to use https://www.wunsch-hund.de instead of http://wunsch-hund.de. It doesn't make sense to have to go through two redirects when it can be perfectly avoided.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Kontento
Hello Nicholas,
I see, you are right. We followed your suggestion. Thanks for support!

Regards,
Wolfgang

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!