/    Sign up×
Community /Pin to ProfileBookmark

Redirect if top level URL not entered?

This must be fairly easy, but I’m a little new…

I want to redirect to my root site ([url]www.mysite.com[/url]) when someone enters a page other than index.htm into their browser. In other words, “www.mysite.com” and “www.mysite.com/index.htm” would have the same effect, but “www.mysite.com/otherpage.htm” would redirect to the main site. I still want to be able to have “www.mysite.com/otherpage” be able to be seen, providing it gets there from a link off the top page.

Any helpers would be welcomed!


Keith

to post a comment
HTML

19 Comments(s)

Copy linkTweet thisAlerts:
@PeOfEoFeb 14.2004 — [i]Originally posted by tanglin [/i]

[B]This must be fairly easy, but I'm a little new...



I want to redirect to my root site (www.mysite.com) when someone enters a page other than index.htm into their browser. In other words, "www.mysite.com" and "www.mysite.com/index.htm" would have the same effect, but "www.mysite.com/otherpage.htm" would redirect to the main site. I still want to be able to have "www.mysite.com/otherpage" be able to be seen, providing it gets there from a link off the top page.



Any helpers would be welcomed!



--

Keith [/B]
[/QUOTE]
keep in mind that not all browsers are going to support this regirect, weather it be server side or client side.
Copy linkTweet thisAlerts:
@Paul_JrFeb 14.2004 — [i]Originally posted by PeOfEo [/i]

[B]keep in mind that not all browsers are going to support this regirect, weather it be server side or client side. [/B][/QUOTE]

Why not? It's ServerSide... what does the browser have to do with it?
Copy linkTweet thisAlerts:
@PeOfEoFeb 14.2004 — [i]Originally posted by Paul Jr [/i]

[B]Why not? It's ServerSide... what does the browser have to do with it? [/B][/QUOTE]
I do not know why exactly, but older browsers do not support it. IE4 I think will fail to perform this. It confuses me too.
Copy linkTweet thisAlerts:
@Paul_JrFeb 14.2004 — [i]Originally posted by PeOfEo [/i]

[B]I do not know why exactly, but older browsers do not support it. IE4 I think will fail to perform this. It confuses me too. [/B][/QUOTE]

How odd... Screw IE 4 users! If anyone uses IE 4... then... uhm... What the deuce?!
Copy linkTweet thisAlerts:
@PeOfEoFeb 14.2004 — [i]Originally posted by Paul Jr [/i]

[B]How odd... Screw IE 4 users! If anyone uses IE 4... then... uhm... What the deuce?! [/B][/QUOTE]
jus a put a link on the page that reads click here to enter. then another link that reads "download firefly!"
Copy linkTweet thisAlerts:
@tanglinauthorFeb 14.2004 — Well, thanks for the answer on what can happen when you actually do what I'm trying to do, but I'm actually looking for information on how to do it, first...

Anyone?

--

K
Copy linkTweet thisAlerts:
@rpassmoreFeb 18.2004 — this is meant to redirect users to a frameset, but if you put this in every page *but* your index, change the message given to something more suitable...I think it'll have the desired effect?

<SCRIPT LANGUAGE="javascript">

if (self==parent)

{

document.write('<b>THIS IS A FRAME ELEMENT</B>')

document.write('You will be transported to frames in a second')

document.write('<META HTTP-EQUIV="refresh" CONTENT="1; URL=framepage.html">')

}

</SCRIPT>

oh by the way..first post, new user: dull, boring aspiring web designer. HI! ?


and to give credit, I pulled this code from http://www.htmlgoodies.com/articles/framesandspiders2.html

hope it helps.
Copy linkTweet thisAlerts:
@tanglinauthorFeb 18.2004 — Thanks for the input, I'll try it.

My first post too.

K.
Copy linkTweet thisAlerts:
@tanglinauthorFeb 18.2004 — Works great!
Copy linkTweet thisAlerts:
@rpassmoreFeb 18.2004 — hehe....actually I just now thought of a potential problem, if you're not using frames of any sort.....every page is a parent. therefor even if you linked from within your site...it's revert back to your chosen page. lol

but it sounded good. sorry :p

although..I do remember seeing something recently about creating a "bot" file, telling the indexing bots where to rederict links to. if you're not framed..I think it's the only way I've seen. I'll try to dig it up
Copy linkTweet thisAlerts:
@Paul_JrFeb 18.2004 — This probably could be done quite easily in PHP. I think your best bet would be a SSL. Besides, it won't work for users without JS enabled/available.
Copy linkTweet thisAlerts:
@tanglinauthorFeb 18.2004 — I am using frames, it works fine.
Copy linkTweet thisAlerts:
@rpassmoreFeb 18.2004 — hehe..ok just did some searching. glad it works though ?

but.....here's info on the "robot's meta tag" for fyi purposes. In fact, it might be better then the jscript way.

http://www.search-engine-optimization-help.net/robots.htm

good info, wish they'd chosen different colors for that page though...ugh
Copy linkTweet thisAlerts:
@PeOfEoFeb 18.2004 — [i]Originally posted by tanglin [/i]

[B]I am using frames, it works fine. [/B][/QUOTE]
keep in mind some older browsers are not going to render frames correctly either. Try viewing your frames on good old lynx, ie2, so on and so fourth. Not to mention that frames are going to fail for audio braille browsers, and they will lower a search engine ranking.
Copy linkTweet thisAlerts:
@tanglinauthorFeb 19.2004 — Well, if I am not worried or losing any sleep about losing business to the millions of users who're running IE2. And I might be un-PC but I doubt I'll cater for audio braille users often, either.
Copy linkTweet thisAlerts:
@PeOfEoFeb 19.2004 — [i]Originally posted by tanglin [/i]

[B]Well, if I am not worried or losing any sleep about losing business to the millions of users who're running IE2. And I might be un-PC but I doubt I'll cater for audio braille users often, either. [/B][/QUOTE]
i take offence, sometimes I run around on lynx for the heck of it! These browsers might make up a small % of the internet, but the internet is huge so it is still a lot of people. Do not forget that making sites inaccessable is violating the citizens with disabilities act.
Copy linkTweet thisAlerts:
@Daniel_TFeb 19.2004 — [i]Originally posted by PeOfEo [/i]

[B]jus a put a link on the page that reads click here to enter. then another link that reads "download firefly!" [/B][/QUOTE]


lol. u still think firefly is a better name?

-Dan
Copy linkTweet thisAlerts:
@IncaWarriorFeb 19.2004 — peofeo- do you buy things using lynx?

i go with the opera now, it's really fast
Copy linkTweet thisAlerts:
@tanglinauthorFeb 19.2004 — [i]Originally posted by PeOfEo [/i]

[B]i take offence, sometimes I run around on lynx for the heck of it! These browsers might make up a small % of the internet, but the internet is huge so it is still a lot of people. Do not forget that making sites inaccessable is violating the citizens with disabilities act. [/B][/QUOTE]


Actually, it's the Americans with Disabilities Act. And currently it only applies to Federal sites.

And I'm English.
×

Success!

Help @tanglin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...