Reputation: 129
How to write the htaccess rule based on
http://mysite.com/http://google.com -> http://google.com
http://mysite.com/http://facebook.com -> http://facebook.com
should redirect with 302 to that url ( except the main file index.php ), so the actual referrer would be hidden, Thank you.
Upvotes: 2
Views: 398
Reputation: 786291
Put this code in your .htaccess under DOCUMENT_ROOT:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(https?://[^\s]+) [NC]
RewriteRule ^ %1 [R,L]
Upvotes: 1
Reputation: 7066
If I make the assumption that all your links will start with a protocol then the following will work:-
RewriteEngine On
RewriteBase /
RewriteRule ^(https?)://(.*)$ $1://$2 [NC,L,R=302]
Upvotes: 0