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

Материал из Umicms
Перейти к:навигация, поиск
 
(не показана 1 промежуточная версия 1 участника)
Строка 1: Строка 1:
'''Актуально для версии 18.'''
+
'''Актуально для версии 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 ^sitemap([0-9]*)\.xml$  sitemap.php?id=$1 [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]
 
RewriteRule ^composer\.umi\.lock$ / [L,R]
 
RewriteRule ^composer\.umi\.json$ / [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} !^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|autothumbs|captcha|counter|cron|go-out|license_restore|save_domain_keycode|session|static_banner|updater)\.php$">
RewriteRule ^(.*)\.xml$ index.php?xmlMode=force&path=$1&%{QUERY_STRING} [L]
+
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>
  
RewriteCond %{REQUEST_FILENAME} !-f
+
<IfModule mod_php5.c>
RewriteRule ^(.*)\.json$ index.php?jsonMode=force&path=$1&%{QUERY_STRING} [L]
+
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} !^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|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 ^(.*)$ 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_URI} (\.ttf|\.TTF)$
 
RewriteCond %{REQUEST_URI} (\.woff|\.WOFF)$
 
RewriteCond %{REQUEST_URI} (\.svg|\.SVG)$
 
 
 
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>
 
 
 
 
######################## 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>