Just detailing what was said by Anderson, Voce can use the URL rewriting.
--
The. htaccess (the file name is written this way, with a dot on the front) is a special file used by Apache (web server) that checks if there are any restrictions or special configuration for the accessed directory. It is with it that we will activate the URL rewriting and configure other necessary parameters.
Create the . htaccess file, insert the content below and save it in the root folder of your project (the same one where your index.php is located).
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
The first line enables rewriting.
The second and third lines tell Apache to ignore the rewrite if the address refers to a file ("f" of file) or folder ("d" of directory).
The fourth line tells Apache which rewrite rule will be applied. It basically captures everything that comes after index.php and returns as a parameter to the page. I won’t go too far in the details of this configuration, but in case you want to know more the answer, I recommend to see the documentation of Apache mod_rewrite.
There are some variations of this configuration, but this is the one I use.
OBS: Also remember to enable Apache mod_rewrite and restart it. If you don’t know how to do Google search according to your operating system.
--
Take a look at this blog:
http://www.sergiotoledo.com.br/tutoriais/php/reescrita-de-url
I think what you want is URL rewriting. Search about this.
– Woss
No Anderson, I would like to know how to make a category using PHP without using folders.
– user81560
With the rewrite you can do this. You can create a file
videos.php
and make a URLlocalhost/videos
run this file.– Woss
ha ok, I’ll see if I can find something related to that, thank you!
– user81560
Thanks Anderson was that same, thanks man, can you reply to me mark as solved?
– user81560