Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

DNABeast's avatar

Giving a route name an extension

So I've got an old rss feed that I want to maintain The old address was

http://smartenough.org/podcast_rss.php

I've set up the new one using laravel to be at

http://smartenough.org/feed

It works great BUT I also want to support those old subscribers so I put this line in my route file

Route::get('podcast_rss.php', 'RssController@index');

and it seems that route names that end in .php fail giving the error 'No input file specified'.

Is there any way to get this working?

0 likes
8 replies
alexhiggins's avatar

Personally I wouldn't do that. I would set up redirects. I am not 100% sure on how to hook into Laravels system for this but just before a 404 page loaded there might be a way to set up a look up table (a db table with old url --> new url) and redirect to the new url with a 301 redirect

DNABeast's avatar

I created a file called podcast_rss.php that was a 301 redirect and itunes coughed up a lung. Gave a 301 error.

DNABeast's avatar

The current solution makes me feel very dirty. I duplicated the index.php file and renamed it podcast_rss.php

then I created a filter that checks the basename of the URL. If it's podcast_rss.php it runs the same code the feed controller does. But I cut and pasted.

Oh Lord forgive me I cut and I pasted.

alexhiggins's avatar

Definitely wouldn't be doing that.

I am not certain how Laravel handles .php extensions I just get a no input specified page (I think it's just telling you it cannot find a page to execute). But for these things it's redirects you want. You need to be telling search engines that the page has moved, not giving it 2 of the same page and users would just get redirected to the correct url

bashy's avatar
bashy
Best Answer
Level 65

.php in route does work but I wouldn't recommend it. Can easily do a 301 redirect with Nginx or Apache.

DNABeast's avatar

I had already set up a 301 redirect using php header codes. Turns out iTunes didn't like that. Now that I've set it up with Nginx it's all working like a charm. Thanks.

bashy's avatar

Always best to do it in the web server config indeed :)

Please or to participate in this conversation.