Hello, mate. In this case, you would be using . htaccess Friendly URL, as mentioned in several comments from our teammates.
In your case you should pass the parameters to the URL and thus open the file with the parameters accordingly.
Here is an example:
RewriteEngine on
RewriteRule ^([a-zA-Z])/([a-zA-Z0-9_-]+)/([0-9])$ index.php?page=$1&p=$2&id=$3 [QSA]
In that case:
Rewriteengine on: Essential for creating your friendly URL’s. Put this above where you will specify your rules. Rewriterule: indicates the beginning of your rule. ^([a-za-Z])/([a-za-Z0-9_-])/([0-9])$ indicates with regular expressions the format of the URL that will fall in this rule, in which case the URL should start with some value from a to z upper or lower case / value from a to z upper or lower case or numbers, as well as "_" and "-" / numerical value. At the end, index.php? page=$1&p=$2&id=$3 [QSA] indicates which URL he will access through this rule, specifying with $1, $2 and $3 the regular expressions in their proper parameters. [QSA] should appear at the end, to specify that your rule contains a string for query ("Query String Append"), in this case, our parameters.
Using that rule I quoted, http://www.seusite.com/ucp/edit/58 would be the same thing to access http://www.seusite.com/index.php?page=ucp&p=edit&id=58.
Important: Be sure apache rewrite mod is enabled.
Here’s how to use htacess: http://blog.thiagobelem.net/learning-urls-friends-withcomplex rules
– Diego
I would recommend you to see some php framework to make your life easier. I would recommend Codeigniter. A hand on the wheel. However, as you said you are starting out, knowing how to program in pure language is important as well. htaccess is a solution to your problem.
– Paulo Weverton
Only by adding relevant information... for using . htacess, you need to have mod_rewrite enabled on your server.
– Rômulo O. Torres
The source code structure is sometimes the most convenient for organizing the URL. If you don’t need a framework, a library that does the URL routing can be useful. I recommend against using . htacess because it creates dependency on the HTTP server you are using, if you want to change pro Nginx then it will take work.
– rodorgas
If it is what I am thinking it is quite simple. You just need to create a folder with the name you want and put the file
index.php
inside. If you are just organizing the URL, then you may be using friendly URL’s.– user45722
Did any of the answers help?
– Vinícius Lima