Reputation: 17486
How can I set .htaccess file to redirect users to the other url keeping same folder name, file name?
For example,
If user connects to the address
http://previous.com/folder/fileName
I want the user to be redirected to
http://after.com/folder/fileName
keeping all the folder/file information using .htaccess file in the root directory.
Upvotes: 0
Views: 10947
Reputation: 9529
Try adding the following to your htaccess file in the root directory of previous.com
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^previous\.com$
RewriteRule ^ http://after.com%{REQUEST_URI} [L,R=301]
Upvotes: 3