Welcome to WebmasterWorld Guest from 54.196.223.42

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

301 mp3 to homepage

     
3:56 pm on May 23, 2014 (gmt 0)

New User

joined:Apr 14, 2014
posts:15
votes: 0


Hello

my site has an mp3 located at www.example.com/audio/song.mp3
This happens to have a lot of backlinks and I want to redirect it to my homepage.

Is this code valid:

RewriteEngine On
# Redirect non-www to www:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^.*/index\.html
RewriteRule ^(.*)index.html$ /$1 [R=301,L]

Redirect 301 /audio/song.mp3 http://www.example.com
4:31 pm on May 23, 2014 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:2808
votes: 71


Hello unclej, your question makes me ask if these are backlinks or hotlinks that you want to redirect? It is a media file, not a page.

Before you get to that part, you should take a look at the rest of the htaccess rules you have in place and reverse the order of those first two rules so the server doesn't need to loop twice for one request. That rule in #1 position doesn't look quite right.
5:47 pm on May 23, 2014 (gmt 0)

New User

joined:Apr 14, 2014
posts:15
votes: 0


not sure what a hotlink is...but a lot of websites directly linked to the mp3. Now the mp3 no longer exists and I want to redirect all the link juice to the homepage.
7:20 pm on May 23, 2014 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:2808
votes: 71


A hotlink is you hosting a resource (like an image or an MP3) that is used as a resource on another site. I am not sure that hotlinked resources carry any link juice, it does not seem that they could since they are not standalone pages that get a slot in the serps. The links were not backlinks beneficial to your site, it was other sites running up your bandwidth usage. If you have removed the file you should return a 404. A 301 redirect tells search engines that what used to be "here" is now over "there" and that isn't what they'll find. Google considers that a soft 404, not a good thing. 404s are natural and normal, soft 404s aren't.
7:30 pm on May 23, 2014 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:13218
votes: 348


Is this code valid:

NEVER combine mod_rewrite and mod_alias in the same htaccess. All the mod_alias rules (Redirect by that name) will execute after the RewriteRules, here meaning after your domain-name and index.html redirects-- which, incidentally, are in the wrong order. Hostname is the very last redirect; index.html is typically the second-to-last.

not sure what a hotlink is...but a lot of websites directly linked to the mp3.

I'm not sure the term "hotlink" applies to an mp3, unless other people's sites are coded to start playing your sounds automatically. We're talking about music files, right?

Mass redirects of nonexistent files to the home page are almost never appropriate. Who cares what the home page is? They wanted music. You can choose to serve a 410, or let it default to 404. Either way, make a nice custom 404/410 page to let your users know what's up.