Welcome to WebmasterWorld Guest from 54.158.183.188

Forum Moderators: phranque

Message Too Old, No Replies

Redirect issue .htaccess

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

New User

joined:Aug 12, 2014
posts: 1
votes: 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)

Administrator from US 

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

joined:Dec 27, 2006
posts:3107
votes: 120


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)

Administrator

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

joined:Aug 10, 2004
posts:10749
votes: 43


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).
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members