Explain how mod_rewrite works

This is a private host from an ISP that doesn’t want to share its secrets.

There is a .htaccess file with the following content:

<FilesMatch "\.(inc)$">
   Order allow,deny
  Deny from all
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/demo/
RewriteRule .* "index.php/?_p=$0" [L]
Options -Indexes

And the index.php file with the following content:


It seems that everything works perfectly, the CNC meets all the requirements of the task.

BUT for some reason /manual/returns Array(0=>404.shtml)?

The provider stubbornly hints that I am bald and sends to the dock using .htaccess

Tell me my mistakes. Another moment: For some reason, the internal error is issued when there are no lines in htaccess RewriteCond %{REQUEST_FILENAME} !-fand RewriteCond %{REQUEST_FILENAME} !-d.

Answer 1, authority 100%

The manualfolder usually comes with an Apache build. Isn’t she mixed in here?

Answer 2, authority 100%

Separately prescribe

   RewriteRule /manual "index.php/?_p=manual" [L]

I didn’t know about the manual. Thank you.

Answer 3, authority 100%

Hehe… The hoster obviously has it in the config

AliasMatch ^/manual ...

somewhere out there. That is, all requests with a path starting with /manual are sent – I don’t know where they are sent, it looks like a piece of the standard config that sends such requests to the Apache documentation.

The problem is that you can’t replace alias at the .htaccess file level, only at the server or virtual host settings level. If the hoster does not provide you with access to Apache settings except in .htacess, then you will have to negotiate with him. Alas.