Temporary redirect 302 to new domain with .htaccess

0

Hi, I'm doing a temporary redirect 302 using .htaccess, my code is

# BEGIN test redirect
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.dominio_nuevo.com  [R=302,L]
</IfModule>
# END test redirect

If I enter the folder of my localhost where the .htacess is, it redirects to the new domain, with the following url

http://localhost/pruebas/redirect_htacces

But to redirect to another page of the same site for example link the htacces does not redirect, I write it in the url of the following way

http://localhost/pruebas/redirect_htacces/contactenos.html
    
asked by Daniel Rueda 16.01.2018 в 13:36
source

1 answer

1

I think this should be worth it.

RewriteEngine on
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=302,L]
  

I understand that the problem is that you need to redirect after the   new domain, the content that RewriteRule has detected that arrives in   the URL (the $ 1 parameter)

Finally, I forgot, remember to reload the configuration for the httpd service

 /sbin/service httpd reload
    
answered by 16.01.2018 в 14:32