Need to glue two sites, faced with the following problem:
If there is a file on the old site, say, http://old-site.com/logo.png , then for some reason it does not redirect to http://new-site.com/logo.png
Conversely, if there is no file, then redirect as it should. Everything works correctly with the rest of the url

 Redirect 301 / http://new-site.com/ 

or

 RewriteCond %{HTTP_HOST} ^old-site.com$ [NC] RewriteRule ^(.*)$ http://new-site.com/$1 [L,R=301] 

all code

 Options +FollowSymLinks # mod_rewrite in use RewriteEngine On ## End of deny access to extension xml files # Block out any script trying to set a mosConfig value through the URL RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR] # Block out any script trying to base64_encode data within the URL RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR] # Block out any script that includes a <script> tag in URL RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR] # Block out any script trying to set a PHP GLOBALS variable via URL RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] # Block out any script trying to modify a _REQUEST variable via URL RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) # Return 403 Forbidden header and show the content of the root homepage RewriteRule .* index.php [F] # ########## End - Rewrite rules to block out some common exploits RewriteBase / ########## Begin - Joomla! core SEF Section # RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # # If the requested path and file is not /index.php and the request # has not already been internally rewritten to the index.php script RewriteCond %{REQUEST_URI} !^/index\.php # and the request is for root, or for an extensionless URL, or the # requested URL ends with one of the listed extensions RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw))$ [NC] # and the requested path and file doesn't directly match a physical file RewriteCond %{REQUEST_FILENAME} !-f # and the requested path and file doesn't directly match a physical folder RewriteCond %{REQUEST_FILENAME} !-d # internally rewrite the request to the index.php script RewriteRule .* index.php [L] #RewriteRule .* / [L] # ########## End - Joomla! core SEF Section Redirect 301 / http://new-site.com/ RewriteCond %{HTTP_HOST} ^old-site.com$ [NC] RewriteRule ^(.*)$ http://new-site.com/$1 [L,R=301] 
  • one
    @Tim Krasko; To format a code, select it with the mouse and click on the button 101010 of the editor. And show all the redirect code. In general, it is impossible to just delete everything except .htaccess ?) - Sh4dow
  • I added the code, but I didn’t understand about “In general, it’s impossible to just delete everything except .htaccess?)” - Tim

0