Answer the question
In order to leave comments, you need to log in
How to replace host in RewriteRule?
Here is the .htaccess code
<FilesMatch "\.(jpg|png|bmp|gif|css|js)$">
Header set Cache-Control "public, max-age=1928448000"
</FilesMatch>
<Files .htaccess>
order allow,deny
deny from all
</Files>
Options All -Indexes
DirectoryIndex index.html index.php
RewriteEngine on
RewriteBase /
# -- RewriteBase /backend/
# -- REDIRECT FROM WWW
# -- RewriteCond %{HTTP_HOST} ^www.assist\.loc$ [NC]
# -- RewriteRule ^(.*)$ http://assist.loc/$1 [R=301,L]
# -- DISABLE HACKING
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
# -- CGI AUTHORIZATION STUFF
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# -- IF NOT END FILE/DIRECTORY - IT IS ROUTE
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule .* index.php [L]
# -- SEO STUFF -- REMOVE INDEX.PHP
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://assist.loc/ [R=301,L]
# -- SEO STUFF -- REMOVE INDEX.HTML
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://assist.loc/ [R=301,L]
# -- SEO STUFF -- REMOVE SLASH FROM BACK OF THE ROUTE-DIRS
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$ $1 [R=301,L]
Answer the question
In order to leave comments, you need to log in
Everything worked out. It turns out that we have no one understands this nonsense. I had to pay three freelancers, but one of them did tell me.
I post .htaccess for the future:
<Files .htaccess>
order allow,deny
deny from all
</Files>
<FilesMatch "\.(jpg|png|bmp|gif|css|js)$">
Header set Cache-Control "public, max-age=1928448000"
</FilesMatch>
RewriteBase /
RewriteEngine on
Options All -Indexes
DirectoryIndex index.html index.php
# -- SEO STUFF - REDIRECT FROM WWW
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
# -- SEO STUFF -- REMOVE SLASH FROM BACK OF THE ROUTES
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# -- SEO STUFF -- REMOVE INDEX.HTML / INDEX.PHP
RewriteCond %{THE_REQUEST} index\.(html|php) [NC]
RewriteRule ^(.+/)?index\.(html|php)$ $1 [L,NC,R=301]
# -- DISABLE HACKING
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
# -- CGI AUTHORIZATION STUFF
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# -- IF NOT END FILE/DIRECTORY - IT IS ROUTE
RewriteCond %{REQUEST_FILENAME} !^favicon\.ico
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question