.htaccess - 如何在 Laravel 中为 ads.txt 进行重定向

标签 .htaccess laravel-5 adsense

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/

相关文章:

javascript - 使用 GET 变量重写表单提交

.htaccess - .htaccess不会重定向到错误页面

.htaccess - 如何动态地将多个域重定向到 woocommerce 产品页面?

php - Laravel:使用 `configureMonologUsing()` 的多个日志提供程序?

wordpress - Adsense 没有出现在新的浏览器标签中

php - 如何配置 laravel 以在主机 One.com 上使用

php - updated_at 列含糊不清,同时用 Eloquent 方式更新

mysql - Laravel 5.4 - 无法更新 mysql 表列

javascript - AdSense 广告有时不展示

angular - 需要身份验证的 Angular 网站上的 Adsense 激活内容不足