Doubt about Categories / PHP or HTML pages!

0

Hello, I'm creating a website and I'm not using WordPress because it's not a blog, and I'd like some help, actually asking a question, can I make categories other than folders? type you create a folder in www with name "videos" and in it puts index.php these things, have how to do this in PHP? without having to create folder and appear the videos there in the hour that enters the category, I think my doubt is not understanding if someone does not understand I will reformulate.

    
asked by anonymous 19.07.2017 / 21:43

1 answer

0

Just detailing what Anderson said, you can use URL rewriting.

-

The .htaccess (the name of the file is written in this way, with a dot in front) is a special file used by Apache (web server) that checks if there is any restriction or special configuration for the directory accessed. It is with it that we will enable URL rewriting and configure other necessary parameters.

Create the .htaccess file, insert the content below and save it to the root folder of your project (the same as your index.php).

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" file) or directory ("d").

The fourth line tells Apache which rewrite rule will be applied. It basically captures everything that comes after index.php and returns as parameter to the page. I will not go into much detail in this configuration, but in case you want to know more about it, I suggest you see the apache mod_rewrite documentation.

There are some variations of this configuration, but this is the one I use.

NOTE: Also remember to enable Apache mod_rewrite and restart it. If you do not know how to search on Google according to your operating system.

-

Take a look at this blog: link

    
19.07.2017 / 22:30