Welcome to WebmasterWorld Guest from 54.167.213.22

Forum Moderators: phranque

Message Too Old, No Replies

Redirect issue .htaccess

     
8:27 pm on Aug 12, 2014 (gmt 0)



Pls help me to do that.

Many links in different post messages like
http://www.site.com/www.example.com


www.site.com - my site
www.example.com - site with data.

Because www.example.com is any site i reffer (used for post message material).. needs following.

When any click on
http://www.site.com/www.example.com
must only open correctly www.example.com

Firefox said that url is invalid url. Needs redirect in htaccess, but how do that...
10:11 pm on Aug 12, 2014 (gmt 0)

WebmasterWorld Administrator 5+ Year Member Top Contributors Of The Month



Hi w00t - welcome to the Forums. Yes, they're definitely invalid and can't go anywhere. Where do these prefixed links come from? Are they generated by a CMS?
10:44 am on Aug 23, 2014 (gmt 0)

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



welcome to WebmasterWorld, w00t!


Many links in different post messages like
http://www.site.com/www.example.com


this is most likely caused by urls being posted without the leading protocol specification (http://) which are treated by the browser as relative urls.
you could fix this by editing or processing the posted urls.

otherwise you should use mod_rewrite to redirect these requests to the proper hostname.
the difficulty is reliable recognizing these external urls so they can be captured for the back reference in the RewriteRule (while excluding local urls from redirecting).
 

Featured Threads

Hot Threads This Week

Hot Threads This Month