Код: Выделить всё
# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
Options +FollowSymlinks
RewriteEngine On
# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
# RewriteBase /
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Rewrite "www.example.com -> example.com"
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to the front controller, index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|blog)
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
# Ensure Authorization header is passed along
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
Код: Выделить всё
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
RewriteCond %{HTTP_HOST} ^blog\.example\.com
RewriteRule ^(.*)$ https://www.example.com/blog/$1 [R=301]
Код: Выделить всё
ServerAdmin [email protected]
ServerName www.example.com
ServerAlias www.example.com
Protocols h2 http/1.1
DocumentRoot /var/www/example-website/public
SetEnv website
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
Alias /blog "/var/www/example-blog/public_html"
SetEnv blog
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
ErrorLog /var/www/example-website/writable/logs/errors.log
CustomLog /var/www/example-website/writable/logs/access.log combined env=website
CustomLog /var/www/example-blog/public_html/wp-content/access.log combined env=blog
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
Код: Выделить всё
ServerAdmin [email protected]
ServerName www.example.com
ServerAlias www.example.com
Protocols h2 http/1.1
Alias /blog "/var/www/example-blog/public_html"
SetEnv blog
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
DocumentRoot /var/www/example-website/public
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
ErrorLog /var/www/example-website/writable/logs/errors.log
CustomLog /var/www/example-website/writable/logs/access.log combined env=website
CustomLog /var/www/example-blog/public_html/wp-content/access.log combined env=blog
RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.
# RewriteCond %{SERVER_NAME} =www.example.com
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/www.example.com-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.example.com-0001/privkey.pem
Подробнее здесь: https://stackoverflow.com/questions/783 ... n-ubuntu-c