Welcome to WebmasterWorld Guest from 18.207.132.114

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Rewrite or redirect all external links, how?

     
8:07 pm on Jul 6, 2006 (gmt 0)

New User

10+ Year Member

joined:July 6, 2006
posts:23
votes: 0


Hi guys, I don't know much about this,I think it should be possible, but don't know how to do it.
I use rss2html script wich converts rss feeds in html form. But the problem is that some feeds include external links. It is tv guides and some events have links to detailed description.
I don't want to link to these sites. At least not directly.
Can someone help me on what should .htaccess file look like that would redirect all urls that are not on my domain to my main page.
Or perhaps to rewrite all of them to add prefix to anonymize them. Either way is fine with me.
Thanks in advance.
8:42 pm on July 6, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 19, 2005
posts:44
votes: 0


Based on your description, you can't do that. If your web page displays a link to another web site (i.e. TV Guide), and I click that link, the request is not going to your web server, it's going to TV Guide's web server. Therefore, none of the settings in your .htaccess file will apply.

The key is when you say, "I don't want to link to these sites." That's your solution. Don't provide the link in the first place. My suggestion would be to see if there's some kind of option in 'rss2html' that turns off the linking. If not, the only other thing you can do is after 'rss2html' is done creating the HTML pages, run some other program to delete all the links.

Once you put the link on the web page, you can no longer control what happens when it's clicked, so you just need to figure out how not to have the link.

11:47 pm on July 6, 2006 (gmt 0)

New User

10+ Year Member

joined:July 6, 2006
posts:23
votes: 0


I tought it would be possible, since I noticed that vbseo plugin(search engine optimization for vbulletin forums) has that option.
It converts all external links like this:

http://www.example.com/forums/redirect-to/?redirect=http://www.externaldomain.com

and it also uses rewrite rules I believe. And it does convert all links on forum fine.
I am not sure if that could apply to the sites I have that use rss2html script.

[edited by: jdMorgan at 12:40 am (utc) on July 7, 2006]
[edit reason] example.com [/edit]

12:40 am on July 7, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


You are trying to change the output of the server, not something that mod_rewrite is useful for.

If you're on Apache 2.0+, then you may be able to use external output Filters [httpd.apache.org] to do this. If you're on Apache 1.x, then you'll need to rewrite all page URLs to a (new) script, and have that script act as a 'wrapper' for your page-generation scripts, invoking them and then post-processing their output to remove the links before sending the result to the client.

I'd recommend looking for an off-the-shelf solution, as this project may consume several days of work otherwise.

Jim

2:13 am on July 7, 2006 (gmt 0)

New User

10+ Year Member

joined:July 6, 2006
posts:23
votes: 0


It seems this is a little beyond me. I was hoping for an easier solution by using .htaccess or by editing html template that rss2html.php uses. But as far as I know there is no html tag or anything similiar to make links appear just as text and not as active links. At least I haven't found any, I've been searching for hours.
Looks like I am gonna just leave it as it is.

But thanks guys for replies.