Home  >  Article  >  Backend Development  >  Apache pseudo-static setting redirects all access directories or files to index.php, but it is invalid when accessing the directory? ? ?

Apache pseudo-static setting redirects all access directories or files to index.php, but it is invalid when accessing the directory? ? ?

WBOY
WBOYOriginal
2016-08-08 09:06:372751browse

The rewriting rules are as follows:

<code> RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php [QSA,PT,L]</code>

For example:

If the accessed directory does not exist or when accessing a file, it can be redirected normally
Apache pseudo-static setting redirects all access directories or files to index.php, but it is invalid when accessing the directory? ? ?

If you access an existing directory

Apache pseudo-static setting redirects all access directories or files to index.php, but it is invalid when accessing the directory? ? ?

I don’t know how to redirect the access directory to the index.php file? ?

Reply content:

The rewriting rules are as follows:

<code> RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php [QSA,PT,L]</code>

For example:

If the accessed directory does not exist or when accessing a file, it can be redirected normally
Apache pseudo-static setting redirects all access directories or files to index.php, but it is invalid when accessing the directory? ? ?

If you access an existing directory

Apache pseudo-static setting redirects all access directories or files to index.php, but it is invalid when accessing the directory? ? ?

I don’t know how to redirect the access directory to the index.php file? ?

Turn off display directory in configuration

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn