
Ask HN: Do you remove your file extensions from URLs? - Random_Person
This is one of those things that I&#x27;ve thought about and battled with for the last few years of learning... should I be removing my extensions? I can&#x27;t find a good answer. Does it hurt me that my users see that I&#x27;m using PHP?
======
jstanley
When you see a URL like news.ycombinator.com/item?id=foo, that isn't
implemented by having a file called item.php. That is implemented by having
URL routing handled by the application instead of by the filesystem.

I don't think there's any point removing extensions from images, CSS,
javascript, etc., but I do think it's worth handling routing in your
application instead of just doing it with a bunch of PHP files.

~~~
Random_Person
Just curious why you would choose to write your own route handler.

I use them (via Laravel) on work projects and I hate them. I hate that I have
to look at a routes file or controller to find out what is pointed where in my
file. I have all my route-handling stuff for each page, at the top of each
page so I don't have to go look elsewhere for that info. Is this wrong?

~~~
jstanley
You wouldn't write your own route handler, you'd just use a framework.

It needn't be complex. I mostly use Mojolicious, where it's as simple as:

get '/' => sub { ... };

get '/item' => sub { ... };

etc.

~~~
Random_Person
Interesting. Thanks!

