Стандартный .htaccess — различия между версиями

Материал из Umicms
Перейти к:навигация, поиск
 
(не показано 7 промежуточных версий 3 участников)
Строка 1: Строка 1:
[[category:.htaccess]]
+
'''Актуально для версии 21.'''
  
<source lang="php">
+
[[category:.htaccess]][[Категория:Вопросы установки настройки и переноса]]
RewriteEngine On
+
<source lang="apache">
#php_value auto_prepend_file "/libs/opaf.umi.php"
+
<IfModule mod_negotiation.c>
#To avoid manual css and js files recompile. Debug only.
+
Options All -Indexes
 +
</IfModule>
  
RewriteRule ^~/([0-9]+)$ tinyurl.php?id=$1 [L]
+
<IfModule mod_rewrite.c>
 +
RewriteEngine On
  
RewriteCond %{REQUEST_FILENAME} -f
+
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(sys\-temp|cache|xmldb|static|packages)\/.*$ 500/ [L]
+
RewriteRule ^(.*)$ index.php?path=$1&%{QUERY_STRING}&umi_authorization=%{HTTP:Authorization} [L]
  
RewriteCond %{REQUEST_FILENAME} !-f
+
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^robots\.txt$ sbots.php?path=$1%{QUERY_STRING} [L]
+
RewriteRule ^(developerTools|errors|libs|smt|cache|xmldb|static|packages)\/.*$ / [L,R] #legacy directories
 +
</IfModule>
  
RewriteCond %{REQUEST_FILENAME} !-f
+
<IfModule mod_php7.c>
RewriteRule ^sitemap\.xml$  sitemap.php [L]
+
php_flag engine off
 +
</IfModule>
  
RewriteRule ^config\.ini$ / [L,R]
+
<IfModule mod_php5.c>
RewriteRule ^install\.ini$ / [L,R]
+
php_flag engine off
RewriteRule ^install\.log$ / [L,R]
+
</IfModule>
RewriteRule ^umi\.nginx\.conf$ / [L,R]
 
RewriteRule ^dbview\.php$ / [L,R]
 
  
RewriteCond %{REQUEST_URI} !^styles
+
<IfModule mod_access_compat.c>
RewriteCond %{REQUEST_URI} !^css
+
<FilesMatch "(?i)\.(php[2-5]?|cgi|pl|fcgi|fpl|phtm|phtml|shtml|asp|jsp|twig|tpl|xslt?|git|svn|htaccess|htaccess_old|htpasswd|gitignore|gitkeep|ini|log|conf|md|sql|lock|umi\.json)$">
RewriteCond %{REQUEST_URI} !\.css
+
Deny from all
RewriteCond %{REQUEST_URI} !^js
+
</FilesMatch>
RewriteCond %{REQUEST_URI} !\.js
 
RewriteCond %{REQUEST_URI} !^images
 
RewriteCond %{REQUEST_URI} !^webstat
 
RewriteCond %{REQUEST_FILENAME} !-f
 
  
RewriteRule ^(.*)\.xml$ index.php?xmlMode=force&path=$1&%{QUERY_STRING} [L]
+
<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer|autothumbs|captcha|counter|cron|go-out|license_restore|save_domain_keycode|session|static_banner|updater)\.php$">
 +
Allow from all
 +
</FilesMatch>
  
RewriteRule ^\/?(udata|upage|uobject|ufs|usel|ulang|utype|umess|uhttp):?(\/\/)?(.*)$ releaseStreams.php?scheme=$1&path=$3?%{QUERY_STRING} [L]
+
<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer)\.php$">
 +
<IfModule mod_php7.c>
 +
php_flag engine on
 +
</IfModule>
  
RewriteRule ^(.*)\.json$ index.php?jsonMode=force&path=$1&%{QUERY_STRING} [L]
+
<IfModule mod_php5.c>
 +
php_flag engine on
 +
</IfModule>
 +
</FilesMatch>
 +
</IfModule>
  
RewriteCond %{REQUEST_URI} !^styles
+
<IfModule mod_authz_core.c>
RewriteCond %{REQUEST_URI} !^css
+
    <IfModule !mod_access_compat.c>
RewriteCond %{REQUEST_URI} !\.css
+
<FilesMatch "(?i)\.(php[2-5]?|cgi|pl|fcgi|fpl|phtm|phtml|shtml|asp|jsp|twig|tpl|xslt?|git|svn|htaccess|htaccess_old|htpasswd|gitignore|gitkeep|ini|log|conf|md|sql|lock|umi\.json)$">
RewriteCond %{REQUEST_URI} !^js
+
Deny from all
RewriteCond %{REQUEST_URI} !\.js
+
</FilesMatch>
RewriteCond %{REQUEST_URI} !^images
 
  
RewriteCond %{REQUEST_URI} !(\.ico|\.ICO)$
+
<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer|autothumbs|captcha|counter|cron|go-out|license_restore|save_domain_keycode|session|static_banner|updater)\.php$">
RewriteCond %{REQUEST_URI} !(\.jpg|\.JPG)$
+
Allow from all
RewriteCond %{REQUEST_URI} !(\.jpeg|\.JPEG)$
+
</FilesMatch>
RewriteCond %{REQUEST_URI} !(\.png|\.PNG)$
 
RewriteCond %{REQUEST_URI} !(\.gif|\.GIF)$
 
RewriteCond %{REQUEST_URI} !(\.css|\.CSS)$
 
RewriteCond %{REQUEST_URI} !(\.js|\.JS)$
 
  
RewriteCond %{REQUEST_FILENAME} !-f
+
<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer)\.php$">
 +
<IfModule mod_php7.c>
 +
php_flag engine on
 +
</IfModule>
  
RewriteRule ^(.*)$ index.php?path=$1&%{QUERY_STRING}&umi_authorization=%{HTTP:Authorization} [L]
+
<IfModule mod_php5.c>
 
+
php_flag engine on
 
+
</IfModule>
RewriteCond %{REQUEST_URI} (\.ico|\.ICO)$
+
</FilesMatch>
RewriteCond %{REQUEST_URI} (\.jpg|\.JPG)$
+
    </IfModule>
RewriteCond %{REQUEST_URI} (\.jpeg|\.JPEG)$
+
</IfModule>
RewriteCond %{REQUEST_URI} (\.png|\.PNG)$
 
RewriteCond %{REQUEST_URI} (\.gif|\.GIF)$
 
RewriteCond %{REQUEST_URI} (\.css|\.CSS)$
 
RewriteCond %{REQUEST_URI} (\.js|\.JS)$
 
 
 
RewriteCond %{REQUEST_FILENAME} !-f
 
  
RewriteRule ^(.*)$ [R=404]
+
<IfModule !mod_authz_core.c>
 +
<IfModule !mod_access_compat.c>
 +
<FilesMatch "(?i)\.(php[2-5]?|cgi|pl|fcgi|fpl|phtm|phtml|shtml|asp|jsp|twig|tpl|xslt?|git|svn|htaccess|htaccess_old|htpasswd|gitignore|gitkeep|ini|log|conf|md|sql|lock|umi\.json)$">
 +
Deny from all
 +
</FilesMatch>
  
 +
<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer|autothumbs|captcha|counter|cron|go-out|license_restore|save_domain_keycode|session|static_banner|updater)\.php$">
 +
Allow from all
 +
</FilesMatch>
  
<IfModule mod_mime.c>
+
<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer)\.php$">
AddType application/x-java-applet .class
+
<IfModule mod_php7.c>
AddType text/x-component .htc
+
php_flag engine on
</IfModule>
+
</IfModule>
  
<IfModule mod_security.c>
+
<IfModule mod_php5.c>
SecFilterScanPOST Off
+
php_flag engine on
 +
</IfModule>
 +
</FilesMatch>
 +
</IfModule>
 
</IfModule>
 
</IfModule>
 
<Files "whatsnew.txt">
 
Deny from all
 
</Files>
 
 
 
</source>
 
</source>

Текущая версия на 08:14, 21 января 2020

Актуально для версии 21.

<IfModule mod_negotiation.c>
	Options All -Indexes
</IfModule>

<IfModule mod_rewrite.c>
	RewriteEngine On

	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^(.*)$ index.php?path=$1&%{QUERY_STRING}&umi_authorization=%{HTTP:Authorization} [L]

	RewriteCond %{REQUEST_FILENAME} -f
	RewriteRule ^(developerTools|errors|libs|smt|cache|xmldb|static|packages)\/.*$ / [L,R] #legacy directories
</IfModule>

<IfModule mod_php7.c>
	php_flag engine off
</IfModule>

<IfModule mod_php5.c>
	php_flag engine off
</IfModule>

<IfModule mod_access_compat.c>
	<FilesMatch "(?i)\.(php[2-5]?|cgi|pl|fcgi|fpl|phtm|phtml|shtml|asp|jsp|twig|tpl|xslt?|git|svn|htaccess|htaccess_old|htpasswd|gitignore|gitkeep|ini|log|conf|md|sql|lock|umi\.json)$">
		Deny from all
	</FilesMatch>

	<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer|autothumbs|captcha|counter|cron|go-out|license_restore|save_domain_keycode|session|static_banner|updater)\.php$">
		Allow from all
	</FilesMatch>

	<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer)\.php$">
		<IfModule mod_php7.c>
			php_flag engine on
		</IfModule>

		<IfModule mod_php5.c>
			php_flag engine on
		</IfModule>
	</FilesMatch>
</IfModule>

<IfModule mod_authz_core.c>
    <IfModule !mod_access_compat.c>
		<FilesMatch "(?i)\.(php[2-5]?|cgi|pl|fcgi|fpl|phtm|phtml|shtml|asp|jsp|twig|tpl|xslt?|git|svn|htaccess|htaccess_old|htpasswd|gitignore|gitkeep|ini|log|conf|md|sql|lock|umi\.json)$">
			Deny from all
		</FilesMatch>

		<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer|autothumbs|captcha|counter|cron|go-out|license_restore|save_domain_keycode|session|static_banner|updater)\.php$">
			Allow from all
		</FilesMatch>

		<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer)\.php$">
			<IfModule mod_php7.c>
				php_flag engine on
			</IfModule>

			<IfModule mod_php5.c>
				php_flag engine on
			</IfModule>
		</FilesMatch>
    </IfModule>
</IfModule>

<IfModule !mod_authz_core.c>
	<IfModule !mod_access_compat.c>
		<FilesMatch "(?i)\.(php[2-5]?|cgi|pl|fcgi|fpl|phtm|phtml|shtml|asp|jsp|twig|tpl|xslt?|git|svn|htaccess|htaccess_old|htpasswd|gitignore|gitkeep|ini|log|conf|md|sql|lock|umi\.json)$">
			Deny from all
		</FilesMatch>

		<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer|autothumbs|captcha|counter|cron|go-out|license_restore|save_domain_keycode|session|static_banner|updater)\.php$">
			Allow from all
		</FilesMatch>

		<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer)\.php$">
			<IfModule mod_php7.c>
				php_flag engine on
			</IfModule>

			<IfModule mod_php5.c>
				php_flag engine on
			</IfModule>
		</FilesMatch>
	</IfModule>
</IfModule>