K
K
kryamk2021-11-13 11:31:30
Apache HTTP Server
kryamk, 2021-11-13 11:31:30

Why does the redirect of the main page of the site to HostCMS not work?

The redirect does not work (more precisely, the bare html of the main page of the old site is loaded). I also tried with Redirect 301 and tried to do it by analogy with the http to https redirect, but not a damn thing. On the new site, the urls do not match, so you have to prescribe for each page
. Here is the htaccess code:

spoiler


## сжатие text, html, javascript, css, xml:
#<ifModule mod_deflate.c>
#AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
#</ifModule>
# 
## кеш браузера
#<ifModule mod_expires.c>
#ExpiresActive On
# 
##по умолчанию кеш в 5 секунд
#ExpiresDefault "access plus 1 days"
# 
## Включаем кэширование изображений и флэш на месяц
#ExpiresByType image/x-icon "access plus 1 month"
#ExpiresByType image/jpeg "access plus 4 weeks"
#ExpiresByType image/png "access plus 30 days"
#ExpiresByType image/gif "access plus 43829 minutes"
#ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
# 
## Включаем кэширование css, javascript и текстовых файлоф на одну неделю
#ExpiresByType text/css "access plus 604800 seconds"
#ExpiresByType text/javascript "access plus 604800 seconds"
#ExpiresByType application/javascript "access plus 604800 seconds"
#ExpiresByType application/x-javascript "access plus 604800 seconds"
# 
## Включаем кэширование html и htm файлов на один день
#ExpiresByType text/html "access plus 43200 seconds"
# 
## Включаем кэширование xml файлов на десять минут
#ExpiresByType application/xhtml+xml "access plus 600 seconds"
# 
## Нестандартные шрифты сайта 
#ExpiresByType application/x-font-ttf "access plus 1 month"
#ExpiresByType font/opentype "access plus 1 month"
#ExpiresByType application/x-font-woff "access plus 1 month"
#ExpiresByType image/svg+xml "access plus 1 month"
#ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
#</ifModule>
#
#
### EXPIRES CACHING ##
#<IfModule mod_expires.c>
#ExpiresActive On
#ExpiresByType image/jpg "access 1 year"
#ExpiresByType image/jpeg "access 1 year"
#ExpiresByType image/gif "access 1 year"
#ExpiresByType image/png "access 1 year"
#ExpiresByType text/css "access 1 month"
#ExpiresByType text/html "access 1 month"
#ExpiresByType application/pdf "access 1 month"
#ExpiresByType text/x-javascript "access 1 month"
#ExpiresByType application/x-shockwave-flash "access 1 month"
#ExpiresByType image/x-icon "access 1 year"
#ExpiresDefault "access 1 month"
#</IfModule>
### EXPIRES CACHING ##

#<IfModule mod_rewrite.c>
#Options +FollowSymLinks
#RewriteEngine on
#RewriteCond %{HTTP_HOST} ^www\.mysite\.ru$ [NC]
#RewriteRule ^(.*)$ https://mysite.ru/$1 [R=301,L]
#</IfModule>


# ВЫШЕ КОД ЗАКОМЕНТИРОВАЛ, АВОСЬ ОН ВЛИЯЕТ


Options +FollowSymlinks
#Options +SymLinksIfOwnerMatch

AddDefaultCharset Off

<Files .htaccess>
    Order Allow,Deny
    Deny from all
</Files>

<IfModule mod_php5.c>
    php_flag magic_quotes_gpc off
    php_flag magic_quotes_runtime off
    php_flag register_globals off
</IfModule>

<IfModule mod_dir.c>
    DirectoryIndex index.php index.htm index.html
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/x-icon "access plus 1 week"
    ExpiresByType image/gif "access plus 1 week"
    ExpiresByType image/jpeg "access plus 1 week"
    ExpiresByType image/png "access plus 1 week"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType text/javascript "access plus 1 week"
    ExpiresByType application/x-javascript "access plus 1 week"
</IfModule>

# Apache 2.2
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
    <IfModule mod_setenvif.c>
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    </IfModule>
</IfModule>

# Apache 1.3, 2.0
<ifModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(css|js)$
    mod_gzip_item_include mime ^application/javascript$
    mod_gzip_item_include mime ^application/x-javascript$
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Filter TRACE, TRACK and DEBUG request methods
    RewriteCond %{REQUEST_METHOD} ^(DEBUG|TRACE|TRACK) [NC]
    RewriteRule ^(.*)$ - [F,L]


    # ГЛАВНАЯ НЕ ХОЧЕТ РЕДИРЕКТИТСЯ, ТОЧНЕЕ ПОЯВЛЯЕТСЯ ГОЛЫЙ HTML
    RewriteRule    /            https://newsite.ru/ [R=301,L]

    # А ВОТ ЭТИ РАБОТАЮТ РЕДИРЕКТЫ
    RewriteRule catalog/               https://newsite.ru/about.html [R=301,L]
    RewriteRule contacts/              https://newsite.ru/contacts.html [R=301,L]
    RewriteRule documets/              https://newsite.ru/documents [R=301,L]
    RewriteRule news/              https://newsite.ru/news/ [R=301,L]
    RewriteRule price/             https://newsite.ru/price.html [R=301,L]



    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php
</IfModule>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question