PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 19, 2022

[FIXED] How to do a redirect in Laravel for ads.txt

 February 19, 2022     .htaccess, adsense, laravel-5     No comments   

Issue

Google wants have access to ads.txt file like "example.com/ads.txt", but in Laravel we need redirect it to "public" folder.

How do it?

I try RedirectMatch 301 ^ads\.txt$ \/public\/ads\.txt, but it doesn't work.


Solution

You can create blade file has name ads.blade.php and put all text from ads.txt to this blade , and create route like that :

Route::get('/ads.txt',function(){
   return view('ads');
});

I tried that when register my website in google



Answered By - Ahmad Abo Zaid
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing