|redirect to text version!|
| 12:07 pm on Jun 12, 2004 (gmt 0)|
ok, ive got my text version of my site up and running, but, the link to it goes to the homepage of the text version, eg, say you're looking at my client list and you want to see it in the text version, you click text only and it sends you to the text version homepage, how annoying!
so then i thought, why dont i create a cgi script or include a php script within my html docs that will get the url from my root domain (www.example.co.uk), add '/text/' to it and then write. this means, when the client is on the client page, currently at www.example.co.uk/clients/index.html and they click text only, this means the cgi/php script will add '/text/' into the url so we get www.example.co.uk/TEXT/clients/index.html.
please help! or atleast teach me! cheers! :D
[edited by: jatar_k at 5:19 pm (utc) on June 12, 2004]
[edit reason] generalized [/edit]
| 6:23 pm on Jun 13, 2004 (gmt 0)|
Welcome to WebmasterWorld ahmedtheking,
all of your pages could contain an dynamic path and only include and link to the text pages instead of the regular pages.
Another thought is to have?type=text or some such var tacked onto the url if they select text only
then have some intelligence in your main template to alter base paths or not include images. It really depends on a lot of different things and is difficult to guess at the best approach for you.
I keep thinking also that you may need some way to make sure that spiders can't get at both versions of the page so there are no duplicate content problems.
| 7:08 pm on Jun 13, 2004 (gmt 0)|
this sort of this is easily acheived using mod_rewite
I have a text viewer script (php) that intercepts .txt requests and presents a cool formatted version instead, there's a link to a plain text version on that page too, or the user could (I guess) make the extension .text and also get the raw version (the php script just passes it through in this case) something like..
# this is the text viewer handler thingie..
RewriteRule (.*)\.t(.*)xt /inc/textview.php?txtfile=/public/docs/$1.t$2xt [NC]
it should be possible to work it out from that.
full source code for the text viewer available onsite!
| 3:24 pm on Jun 14, 2004 (gmt 0)|
woah! totally new to php! could you just explain it to me please? im using dreamweaver so the coding should be easy!
| 6:43 pm on Jun 14, 2004 (gmt 0)|
okay, from the top..
First, it looks simply like your original link is incorrect, I mean, why doesn't the link itself have "/TEXT/" in it? then reuests would go straight into /TEXT/, not the homepage.
If, for some reason, that's not possible, you can get mod_rewrite to add the "/TEXT/" part for you. This goes in your .htaccess file, which is in the root of your site, probably..
RewriteRule ^clients/(.*)/clients/text/$1 [NC]
(I haven't tested that!) but anyway, now you are sending clients to another html page! I thought the user was looking for a text version? Why not send them directly to a text version, instead of another index?
It would be easy enough to have php generate a correct link for you, so a page like..
could have a link on it like..
which seems a better strategy, to me.
I don't understand the problem with the original link. Could you explain why it's not possible to just put the correct link on the original html page in the first place? Or is it?
| 11:10 pm on Jun 14, 2004 (gmt 0)|
ok, erm, where i use dreamweaver or any web author, you cannot have a dynamic link to a certain page. for example, say your viewing some clients at:
and you decide that you want to see the text version of the site. Where i had a link, 'text only', that would point to:
the text version homepage! so the person would have to navigate to the clients page:
i have kinda found a solution to this problem, but only works one way!
document.write(' title=The TEXT VERSION accesskey=h>Text Only</a>');
this means that it will rite a link to /text and the the root path, in this case clients/myf.html
so with this location.pathname, that can be done.
but, is there a way of going backwards? as in, is that a js command where i can alter that, or will i have to use that mod rewrite thing?
also, a prob with js is that some people will have it off, which is a prob cos they want to view the site with no js or anythin! can cgi/php/wotever/ help me over come this?
thanks for all your help! ill make u lot a free website if u want! :D
[edited by: jatar_k at 11:18 pm (utc) on June 14, 2004]
[edit reason] generalized urls [/edit]