ibrahimqd
ibrahimqd

Reputation: 45

Convert links to another domain

I want convert links to another domain

From this : www.old.net/upload/namefolder/namefile.mp3

To : www.new.net/upload/namefolder/namefile.mp3

using .htaccess

How can I do this?

Upvotes: 1

Views: 32

Answers (2)

Pedro Lobito
Pedro Lobito

Reputation: 99081

You can use something like:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.old\.net$ [NC]
RewriteRule ^(.*)$ http://www.new.net [R=301,L]

Upvotes: 2

Sahil Gulati
Sahil Gulati

Reputation: 15141

Try this hope it will work fine.

RewriteEngine On
RewriteCond %{REQUEST_URI} \.(?:mp3)$
RewriteCond %{HTTP_HOST} old\.net [nc]
RewriteRule ^(.*)$ http://www.new.net/$1 [R=301,L,QSA]

Upvotes: 2

Related Questions