Last active
June 15, 2023 09:46
-
-
Save yunusga/98274b67651dfb28d1b691dc1e1c330c to your computer and use it in GitHub Desktop.
RewriteRule для WordPress директории uploads. На случай если нет возможности держать файлы загрузок на своем сервере при тестировании.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# за редирект отвечает | |
# RewriteRule ^wp-content/uploads/(.*)$ https://<production site>/wp-content/uploads/$1 [R=302,NC,L] | |
# должна быть сразу после RewriteEngine On | |
# <wp test directory> необходим если сайт лежит в директории основного домена, например site.com/dev | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteRule ^wp-content/uploads/(.*)$ https://<production site>/wp-content/uploads/$1 [R=302,NC,L] | |
# RewriteRule ^wp-content\/uploads\/(?!(2022\/08)\/)(.*)$ https://divina-bellezza.ru/wp-content/uploads/$2 [R=302,NC,L] | |
RewriteBase /<wp test directory>/ | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /<wp test directory>/index.php [L] | |
</IfModule> | |
# BEGIN Slash to Non-Slash URLs | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)/$ /$1 [L,R=301] | |
</IfModule> | |
# END Slash to Non-Slash URLs | |
# BEGIN Non-Slash to Slash URLs | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*[^/])$ /$1/ [L,R=301] | |
</IfModule> | |
# END Non-Slash to Slash URLs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment