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

Материал из Umicms
Перейти к:навигация, поиск
 
Строка 1: Строка 1:
'''Актуально для версии 20.'''
+
'''Актуально для версии 21.'''
  
 
[[category:.htaccess]][[Категория:Вопросы установки настройки и переноса]]
 
[[category:.htaccess]][[Категория:Вопросы установки настройки и переноса]]
 
<source lang="apache">
 
<source lang="apache">
####################### UMI_CMS_HTACCESS_BEGIN ###########################
+
<IfModule mod_negotiation.c>
RewriteEngine On
+
Options All -Indexes
#To avoid manual css and js files recompile. Debug only.
+
</IfModule>
#RewriteRule (compressed\.js)|(compiled\.js)|(compiled\.css)|(compressed\.css)|(tiny_mce\.js) developerTools/preCompile.php [L]
 
  
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 ^favicon\.ico$  favicon.php?path=$1&%{QUERY_STRING} [L]
+
php_flag engine off
 +
</IfModule>
  
RewriteCond %{REQUEST_FILENAME} !-f
+
<IfModule mod_php5.c>
RewriteRule ^sitemap([0-9]*)\.xml$  sitemap.php?id=$1 [L]
+
php_flag engine off
 +
</IfModule>
  
RewriteRule ^config\.ini$ / [L,R]
+
<IfModule mod_access_compat.c>
RewriteRule ^install\.ini$ / [L,R]
+
<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)$">
RewriteRule ^install\.log$ / [L,R]
+
Deny from all
RewriteRule ^umi\.nginx\.conf$ / [L,R]
+
</FilesMatch>
RewriteRule ^dbview\.php$ / [L,R]
 
RewriteRule ^composer\.umi\.lock$ / [L,R]
 
RewriteRule ^composer\.umi\.json$ / [L,R]
 
  
RewriteCond %{REQUEST_URI} !^styles
+
<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} !^css
+
Allow from all
RewriteCond %{REQUEST_URI} !\.css
+
</FilesMatch>
RewriteCond %{REQUEST_URI} !^js
 
RewriteCond %{REQUEST_URI} !\.js
 
RewriteCond %{REQUEST_URI} !^images
 
RewriteCond %{REQUEST_URI} !^img
 
RewriteCond %{REQUEST_URI} !^webstat
 
RewriteCond %{REQUEST_URI} !^fonts
 
RewriteCond %{REQUEST_URI} !\.ttf
 
RewriteCond %{REQUEST_URI} !\.woff
 
  
RewriteCond %{REQUEST_FILENAME} !-f
+
<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer)\.php$">
RewriteRule ^(.*)\.xml$ index.php?xmlMode=force&path=$1&%{QUERY_STRING} [L]
+
<IfModule mod_php7.c>
 +
php_flag engine on
 +
</IfModule>
  
RewriteRule ^\/?(udata|upage|uobject|ufs|usel|ulang|utype|umess|uhttp):?(\/\/)?(.*)$ releaseStreams.php?scheme=$1&path=$3&%{QUERY_STRING} [L]
+
<IfModule mod_php5.c>
 +
php_flag engine on
 +
</IfModule>
 +
</FilesMatch>
 +
</IfModule>
  
RewriteCond %{REQUEST_FILENAME} !-f
+
<IfModule mod_authz_core.c>
RewriteRule ^(.*)\.json$ index.php?jsonMode=force&path=$1&%{QUERY_STRING} [L]
+
    <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>
  
RewriteCond %{REQUEST_URI} !^styles
+
<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} !^css
+
Allow from all
RewriteCond %{REQUEST_URI} !\.css
+
</FilesMatch>
RewriteCond %{REQUEST_URI} !^js
 
RewriteCond %{REQUEST_URI} !\.js
 
RewriteCond %{REQUEST_URI} !^images
 
RewriteCond %{REQUEST_URI} !^img
 
RewriteCond %{REQUEST_URI} !^fonts
 
RewriteCond %{REQUEST_URI} !\.ttf
 
RewriteCond %{REQUEST_URI} !\.woff
 
  
RewriteCond %{REQUEST_URI} !(\.ico|\.ICO)$
+
<FilesMatch "^(?i)(index|install|umi_smt|installer|dummy|smu/installer)\.php$">
RewriteCond %{REQUEST_URI} !(\.jpg|\.JPG)$
+
<IfModule mod_php7.c>
RewriteCond %{REQUEST_URI} !(\.jpeg|\.JPEG)$
+
php_flag engine on
RewriteCond %{REQUEST_URI} !(\.png|\.PNG)$
+
</IfModule>
RewriteCond %{REQUEST_URI} !(\.gif|\.GIF)$
 
RewriteCond %{REQUEST_URI} !(\.css|\.CSS)$
 
RewriteCond %{REQUEST_URI} !(\.js|\.JS)$
 
RewriteCond %{REQUEST_URI} !(\.ttf|\.TTF)$
 
RewriteCond %{REQUEST_URI} !(\.woff|\.WOFF)$
 
RewriteCond %{REQUEST_URI} !(\.svg|\.SVG)$
 
  
RewriteCond %{REQUEST_FILENAME} !-f
+
<IfModule mod_php5.c>
 
+
php_flag engine on
RewriteRule ^(.*)$ index.php?path=$1&%{QUERY_STRING}&umi_authorization=%{HTTP:Authorization} [L]
+
</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>
  
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_URI} (\.ttf|\.TTF)$
 
RewriteCond %{REQUEST_URI} (\.woff|\.WOFF)$
 
RewriteCond %{REQUEST_URI} (\.svg|\.SVG)$
 
  
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 ^(.*)$ [R=404]
+
<IfModule mod_php5.c>
 
+
php_flag engine on
 
+
</IfModule>
<IfModule mod_mime.c>
+
</FilesMatch>
AddType application/x-java-applet .class
+
</IfModule>
AddType text/x-component .htc
 
</IfModule>
 
 
 
<IfModule mod_security.c>
 
SecFilterScanPOST Off
 
 
</IfModule>
 
</IfModule>
 
<Files "whatsnew.txt">
 
Deny from all
 
</Files>
 
 
 
 
######################## UMI_CMS_HTACCESS_END ############################
 
 
</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>