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

Материал из Umicms
Перейти к:навигация, поиск
(Новая страница: « category:.htaccess <source lang="php"> RewriteEngine On #php_value auto_prepend_file "/libs/opaf.umi.php" #To avoid manual css and js files recompile. Debug o…»)
 
 
(не показано 9 промежуточных версий 3 участников)
Строка 1: Строка 1:
 +
'''Актуально для версии 21.'''
  
[[category:.htaccess]]
+
[[category:.htaccess]][[Категория:Вопросы установки настройки и переноса]]
 +
<source lang="apache">
 +
<IfModule mod_negotiation.c>
 +
Options All -Indexes
 +
</IfModule>
  
<source lang="php">
+
<IfModule mod_rewrite.c>
RewriteEngine On
+
RewriteEngine On
#php_value auto_prepend_file "/libs/opaf.umi.php"
 
#To avoid manual css and js files recompile. Debug only.
 
#RewriteRule (commonClient\.js)|(compressed\.js)|(compiled\.js)|(compiled\.css)|(compressed\.css)|(tiny_mce\.js) developerTools/preCompile.php [L]
 
  
RewriteRule ^~/([0-9]+)$ tinyurl.php?id=$1 [L]
+
RewriteCond %{REQUEST_FILENAME} !-f
 +
RewriteRule ^(.*)$ index.php?path=$1&%{QUERY_STRING}&umi_authorization=%{HTTP:Authorization} [L]
  
RewriteCond %{REQUEST_FILENAME} -f
+
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(sys\-temp|cache|xmldb|static|packages)\/.*$ 500/ [L]
+
RewriteRule ^(developerTools|errors|libs|smt|cache|xmldb|static|packages)\/.*$ / [L,R] #legacy directories
 +
</IfModule>
  
RewriteCond %{REQUEST_FILENAME} !-f
+
<IfModule mod_php7.c>
RewriteRule ^robots\.txt$  sbots.php?path=$1%{QUERY_STRING} [L]
+
php_flag engine off
 +
</IfModule>
  
RewriteCond %{REQUEST_FILENAME} !-f
+
<IfModule mod_php5.c>
RewriteRule ^sitemap\.xml$  sitemap.php [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]
 
  
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} !^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)\.php$">
 +
<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>
  
RewriteRule ^(.*)\.json$ index.php?jsonMode=force&path=$1&%{QUERY_STRING} [L]
+
<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} !^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} !(\.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_FILENAME} !-f
+
<IfModule mod_php5.c>
 +
php_flag engine on
 +
</IfModule>
 +
</FilesMatch>
 +
    </IfModule>
 +
</IfModule>
  
RewriteRule ^(.*)$ index.php?path=$1&%{QUERY_STRING}&umi_authorization=%{HTTP:Authorization} [L]
+
<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>
  
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_FILENAME} !-f
+
<IfModule mod_php5.c>
 
+
php_flag engine on
RewriteRule ^(.*)$ [R=404]
+
</IfModule>
 +
</FilesMatch>
 +
</IfModule>
 +
</IfModule>
 
</source>
 
</source>
 
<IfModule mod_mime.c>
 
AddType application/x-java-applet .class
 
AddType text/x-component .htc
 
</IfModule>
 
 
<IfModule mod_security.c>
 
SecFilterScanPOST Off
 
</IfModule>
 
 
<Files "whatsnew.txt">
 
Deny from all
 
</Files>
 

Текущая версия на 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>