• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

Quick html advice

Code:
BODY onLoad="JavaScript:location.href='newdirectory/page.htm'"
 
You need angled brackets around that, and no space between java and script (which is being inserted by the forum software, I think):

Code:
<BODY onLoad="javascript:location.href='newdirectory/page.htm'">


And it only works for me in Firefox. I can't tell if IE just can't understand it or thinks it's a security risk.

The old school way is to put this between the <head></head> tags:

Code:
<meta http-equiv="refresh" content="2;url=http://www.example.org/subdir/">

Where the 2 is the amount of time in seconds to wait until refreshing.

Edit: how fun; you can force a refresh even from within a forum post if you're not careful.

David
 
davidhorman said:
You need angled brackets around that, and no space between java and script (which is being inserted by the forum software, I think):

I know. :)

davidhorman said:
And it only works for me in Firefox. I can't tell if IE just can't understand it or thinks it's a security risk.

It works for me.

davidhorman said:
The old school way is to put this between the <head></head> tags:

Code:
<meta http-equiv="refresh" content="2;url=http://www.example.org/subdir/">

That is also a solution.
 
I am not an HTML designer... but thoe answers seem odd to me, since they are all exampels of things you would put on a PAGE... but a request for www.foo.bar/ is a request for a DIRECTORY...



If you want a request for www.foo.bar to redirect to www.foo.bar/subdir, there's an immediate problem in that www.foo.bar is a directory, not a page. If you "surf" to www.foo.bar, you've got to hope they've set up some kind of automatic redirection already to take you to www.foo.bar/index.html or whatnot instead. (Unless they allow browsing directories, which is generally not done)

I am assuming the code other people shared would go on that index.html or whatever the page is that you display when they request the directory.

In which case, why not just take that redirector and point it to the new resource?

Or perhaps you want to take a request for www.foo.bar/index.html and a request for www.foo.bar/mypage.html and have them BOTH translated to www.foo.bar/subdir/index.html and www.foo.bar/subdir/mypage.html? In that case, you'll want to set up an alias for the entire directory, or use mod_rewrite or something similar to rewrite the URLs "on the fly."

I don't know jack about IIS (except it sucks!) but here's how you'd accomplish each of the above on Apache:

1) Redirect requests for www.foo.bar to a specific page:

AliasMatch ^/$ /var/www/subdir/index.html

2) Redirect all requests for /whatever.html to /subdir/whatever.html:

DocumentRoot /var/www
Change to:
DocumentRoot /var/www/subdir

*WARNING* The above will screw up any other subdirectories you've been using -- they'll all move out of scope. So you might want to do it another way:

You could rewrite it using something like the AliasMatch above -- but it would be a bit more complex, needing to preserve part of the initial request. I can't remember the apache syntax for that off the top of my head. Might be like a regular regexp:

AliasMatch ^/([^/]*)/+$ /var/www/subdir/$1

You'd have to check the docs to see if that's anything like right. Heh!


These sloutions are "better" because all the other proposed solutions require the user's browser to download two pages, increasing the amount of traffic to your site -- plus it's done in the HTML which just seems sloppy to me, I guess... HTML isn't there to control access to your webserver. Quite the opposite, in fact.


-Chris
 
I am not an HTML designer... but thoe answers seem odd to me, since they are all exampels of things you would put on a PAGE... but a request for www.foo.bar/ is a request for a DIRECTORY...

No offence to Diamond, but I assumed from his post that he's not the kind of guy who would have that kind of access to his own server. And he did say:

How do I automatically forward a browser from the index page to another directory

I don't know for sure, but at least some of those Apache changes won't update the browser's URL to the new location; it all happens transparently on the server. I am now, of course, drifting into the realms of the horribly pedantic...

:p

David
 
How do I automatically forward a browser from the index page to another directory

I know, right? That's what confused me: It shuold be more like... "How do I forward requests for the root directory to another directory" or "How do I forward requests for the index page to another page" or "how do I forward requests for all pages in a particular directory to the same pages in another directory?"

As asked, the question doesn't make perfect sense... does he really want requests for a PAGE to be redirected to a DIRECTORY? Possible, but doubtful.

I am now, of course, drifting into the realms of the horribly pedantic...

I thought I was the one who brought us there. :P
 
In this particular case, the website is hosted remotely and I have no access to the Apache settings (surprise, surprise)
 

Back
Top Bottom