C
C
choodo2016-11-03 18:41:28
Apache HTTP Server
choodo, 2016-11-03 18:41:28

How to describe .htaccess rules?

Situation: site on Bitrix. I "transfer" all links in the search from the old site to the new one using Redirect 301. In what sequence should I describe the rules in .htaccess so that everything works correctly?
Conditions:
- "move" 333 links in the search to new paths on the new site
- redirect all calls to www.domen.ru to domen.ru, including calls with a path, and not just a capital (/)
Original .htaccess here such:

Options -Indexes 
ErrorDocument 404 /404.php

<IfModule mod_php5.c>
  php_flag session.use_trans_sid off
  #php_value display_errors 1
  #php_value mbstring.internal_encoding UTF-8
  php_flag register_globals off 	
</IfModule>

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
  RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
  RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>

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

<IfModule mod_expires.c>
  ExpiresActive on
  ExpiresByType image/jpeg "access plus 3 day"
  ExpiresByType image/gif "access plus 3 day"
  ExpiresByType image/png "access plus 3 day"
  ExpiresByType text/css "access plus 3 day"
  ExpiresByType application/javascript "access plus 3 day"  
</IfModule>

Before which lines do you need to put instructions about redirecting to an address without www?
# to without www
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Where to do I need to put instructions about redirecting from the old paths to the new ones so that they work with the rule of redirecting from www to a non-www address? If I "enable" redirect rules from www to a non-www address, then the rules below don't work.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^menu/$ domen.ru/company/? [L,R=301]
RewriteRule ^menu/activity/$ domen.ru/company/? [L,R=301]
RewriteRule ^menu/activity$ domain.ru/company/? [L,R=301]

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