Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Htaccess: redirect from old domain to new

Tags:

.htaccess

I have a olddomain.com that needs to point to newdomain.com

so if somebody tries to enter oldomain.com/whatever they get to newdomain.com

i dont wnat to exactly map old urls so just that would be ok i have tried with

RewriteEngine On
Redirect 301 / http://www.newdomain.com

but it doent work well if i try with

oldomain.com/whatever  

the url appears in the broswer:

newdomain.comwhatever 

(without the /)

like image 699
Yala Yala Herzlin Avatar asked Jan 22 '26 06:01

Yala Yala Herzlin


1 Answers

This should work:

RewriteEngine On
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,NC]
like image 142
jfatal Avatar answered Jan 24 '26 12:01

jfatal