DirectorySlash Off
<base>
htmlbook.ru/html/base RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]{0,7})$ /go?id=$1 [L]
IndexIgnore .* *.php *.zip css js fonts img
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/myFolder/(css|js|fonts|img)/(.*)$ [NC]
RewriteRule ^ /myFolder/.%1/%2 [QSA,L]
Options +FollowSymLinks
DirectorySlash Off
RewriteEngine On
RewriteRule ^blog/$ /blog [R=301,L]
RewriteRule ^blog$ /blog/index.php [L]
<?php
if ($_SERVER['SERVER_PORT'] != '443') {
header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], true, 301);
exit;
}
?>
<html>
<head><title>401 Unauthorized</title></head>
<body><h1>Unauthorized</h1></body>
</html>
ErrorDocument 401 /401.php
RewriteCond %{CF-Connecting-IP} ^XXX.YY.* RewriteCond %{X-Real-IP} ^XXX.YY.*
RewriteCond %{HTTP:CF-Connecting-IP} !^XXX\.YY\.
RewriteCond %{HTTP:X-Real-IP} !^XXX\.YY\.
RewriteEngine On
RewriteCond %{HTTP:X-Real-IP} !^XXX\.YY\.
RewriteRule (.*) - [F]
<VirtualHost 127.0.0.1:8080>
ServerName www.site.ru
Redirect / http://site.ru/
</VirtualHost>
<VirtualHost 127.0.0.1:8080>
ServerName site.ru
DocumentRoot /SOME_PATH/site/site.ru/www
...
</VirtualHost>
<VirtualHost 127.0.0.1:8080>
ServerName site.ru
ServerAlias *.site.ru
VirtualDocumentRoot /SOME_PATH/site/site.ru/%1
...
ProxyPass /phpmyadmin !
ProxyPass / http://site.ru:3000/
<Directory>
можно использовать только в контексте server config, virtual host.AllowOverride None
и Apache не читает .htaccess, либо картинки раздаются вовсе без его участия, например Nginx. RewriteEngine On
RewriteCond %{THE_REQUEST} " /(pages/|[^?]*\.php)" [OR]
RewriteCond %{SERVER_PORT} !443 [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(pages/|)(.*?)(\.php|$) https://site.ru/$2 [R=301,L]
RewriteCond %{DOCUMENT_ROOT}/pages/$1.php -f
RewriteRule ^(.*)$ pages/$1.php [L,QSA]
<Files "protected_file.php">
AuthName "Member Only"
AuthType Basic
AuthUserFile /etc/apache2/.htpasswd
require user Vasily
Satisfy All
</Files>
Satisfy Any
AuthName "Member Only"
AuthType Basic
AuthUserFile /etc/apache2/.htpasswd
require valid-user
Satisfy All
Header set Content-Disposition attachment "expr=%{QUERY_STRING} == 'download=1'"
Header set Content-Disposition attachment env=attach
RewriteCond %{QUERY_STRING} =download=1
RewriteRule ^ - [E=attach:1]
ServerName domain.ru
ServerAlias *.domain.ru
ServerSignature Off
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.ru [NC]
RewriteRule ^/(.*) http://www.domain.ru/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^(www\.)?+.+\.domain\.ru$ [NC]
RewriteRule ^/(.*)\.html$ /index.php?page=$1 [L]
RewriteRule ^/
/
In VirtualHost context, The Pattern will initially be matched against the part of the URL after the hostname and port, and before the query string (e.g. "/app1/index.html"). This is the (%-decoded) URL-path.
In per-directory context (Directory and .htaccess), the Pattern is matched against only a partial path, for example a request of "/app1/index.html" may result in comparison against "app1/index.html" or "index.html" depending on where the RewriteRule is defined.
/
RewriteEngine on
RewriteBase /
Options All -Indexes
RewriteRule ^dist/(.*)$ site/src/dist/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ site/src/index.html [L]