Google 想要访问 ads.txt 文件,例如“example.com/ads.txt”,但在 Laravel 中,我们需要将其重定向到“public”文件夹。
怎么办?
我试试 RedirectMatch 301 ^ads\.txt$ \/public\/ads\.txt
,但它不起作用。
最佳答案
将您的 ads.txt 文件放在文件夹:public(对于 Laravel),然后可以通过链接访问它:example.com/ads.txt。我已经在我的 Laravel 网站上制作了并且运行良好
关于.htaccess - 如何在 Laravel 中为 ads.txt 进行重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57220811/