我的apache根文件夹中有以下结构:
系统 - >包含我系统所有php文件的文件夹。
WebService - >用于webservice的php文件的文件夹。
Crontab - >带有crontab例程的文件夹。
Error.php - >用于管理错误的php文件(404,403,500)。
这是我在系统文件夹中的htacess,有什么方法可以改进它吗?
# Blocks the folder listing
Options -Indexes
# url configuration
<IfModule mod_rewrite.c>
RewriteEngine On
# Search system
RewriteRule ^Busca(/.*)?$ Search/$1.php
# Forces the use of https
#RewriteCond %{SERVER_PORT} 80
#RewriteRule ^(.*)$ http://127.0.0.1/$1 [R,L]
# Removes the final dash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://127.0.0.1/$1 [R=301,L]
# Resolves .php to external domains
RewriteRule ^([^/.]+)$ $1.php [L]
# Blocks .php on URL
RewriteCond %{THE_REQUEST} ^(?:GET|POST)\ /.*\.php\ HTTP.*$ [NC]
RewriteRule ^(.*)\.php$ http://127.0.0.1/erro?n=403 [R=301,L]
</IfModule>
# Protects the .htaccess file
<files ~ "^.*\.([Hh][Tt][Aa])">
order allow,deny
deny from all
satisfy all
</files>
# Forces the use of UTF-8
<FilesMatch ".(htm|html|php|css|js)$">
AddDefaultCharset UTF-8
</FilesMatch>
# Basic compression
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|php|js)$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
# Protects the files and directories
<FilesMatch "(\.(Search|CSS|Funcoes|Imagens|Paginas|JS|Modules|Fonts|.*sql|Instalacao|WebServer|Arquivos|Crontab(\.php)? |xtmpl)|code-style\.pl)$">
Order allow,deny
</FilesMatch>