For a long time I have been worried about creating a catalog on the site.

I would like to know how to create a directory and, if possible, a subdirectory.

Example: site.ru/dir or with subdirectory site.ru/dir/subdata/

Site normal with pma (phpmyadmin)

Closed due to the fact that the question is too general for the participants D-side , aleksandr barakin , Alexey Shimansky , Alex , Kromster 21 Dec '16 at 5:01 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    And what's the big deal about phpmyadmin and mysql? - DemoS
  • I wrote for information .. will there be few questions: a website in php or simple html pages. - monbash

2 answers 2

Links like http://site.ru/questions/something_else/ are called CNC . In fact, there may be no questions and something_else folders. In this case, you need to read about mod_rewrite and htaccess

PS I can tell you about the method that I use personally. I prescribe in .htaccess:

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [L] 

At the very top of the index.php document I connect a file handler in which, using $ _SERVER ['REQUEST_URI'], I get a line of the following form: / questions / something_else /, which I divide into components:

 $url = $_SERVER['REQUEST_URI']; $url = explode("/", $url); 

"Kill" in the resulting array empty elements and get individual values, the use of which is a matter of technology.

  • Thank you very much .. :) I found something like this, but there was little information, but here it was completely :) - monbash

The question is unclear.

If you just need a folder on the server, then it is created by means of the OS:

 mkdir -p path 

If you need to create a folder while the site is running, then it comes down to executing the same OS command from php (provided you have the necessary execution rights)

 exec('mkdir -p path'); 

If you need to manipulate access to folders, this is done by setting permissions or Apache directives (or another web server)

 <Directory path> ... </Directory> 
  • I now meant the directory ... For example, let's say hashcode.ru and I need to make hashcode.ru/questions in such a way that the necessary information is displayed on this page. Let's say it will be articles, clicked, there were articles or a gallery. - monbash