Sufiyan Ghori
Sufiyan Ghori

Reputation: 18753

.htaccess redirecting URLs

I am making a script that convert rapidshare links to my domain links, example

rapidshare.com/files/3344276068/abc.rar -> mydomain.com/files/3344276068/abc.rar

so when the user visits mydomain.com/files/3344276068/abc.rar he is actually downloading, rapidshare.com/files/3344276068/abc.rar

but i am having problem doing this,

here is my .htaccess file

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(.+)\.php$ http://rapidshare.com/

It replaces mydomain with rapidshare.com , this is working when i am opening mydomain.com (i am redirecting to rapidshare.com) but when i open a file ,

mydomain.com/files/3344276068/abc.rar

it give me error ? what is the problem with the code ? :S

Upvotes: 0

Views: 163

Answers (2)

anubhava
anubhava

Reputation: 785146

The code that you need is this:

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(files/.*)$ http://rapidshare.com/$1 [NC,L,R]

Upvotes: 0

majic bunnie
majic bunnie

Reputation: 1405

You have a few problems, you're only matching against .php files so .rar files won't match the redirect. Also, you need to place your capture section on the end of the url you are redirecting to. It should look more like:

RewriteRule ^(.+)$ http://rapidshare.com/$1

Upvotes: 3

Related Questions