![]() |
page redirect question
first time to post in the programming forum.
if my website is located at "www.mydomain.com" how would i get it to default to a page that isn't located at the root? so if the file i want displayed when people type "www.mydomain.com" is actually stored in "www.mydomain.com/randomfile/", what is the most effective way to do that? is there a way? i apologize if this question has a ridiculously easy answer. i've done a few google searches but nothing answers my question specifically. |
The low-tech way is to add the following tag to the -head- of your current default page:
<meta http-equiv="Refresh" content="0; URL=http://www.mydomain.com/randomfile/"> (The zero, if you didn't know, is the number of seconds you want the browser to display the current page before redirecting. Zero would tell the browser to redirect immediately, but the actual speed depends on a number of factors, so the page content might display briefly. You can always display the link as well on the page.) Anything more complicated than that either requires a scripting language (coldfusion, asp, jsp...) or a configuration at the web server that handles the redirect. Hope that helps. |
you can also easily do this with php or javascript. but keep in mind, you should have a good reason for this especially if you rely on or desire search engine listings because many search engines penalize you for automatic redirects.
The best solution is to move your landing page to web root or to modify your webserver configuration to point to the desired page. |
wow, two worthy responses in less than 2 hours. that's why i love TFP.
i wanted to keep the start page off the root for simplicity in the actual file structure and a strange desire to keep whatever i can off the root directory borrowed from areas in computing where i am much more knowledgeable.. the site just a personal one done for family reasons... so i'm sure they'll forgive me for a redirect. however, when commercial sites do this it does annoy me a bit. i really should just knuckle down and get a scripting language like php under my belt. thanks again for the two answers. please add more to the discussion if anything comes to mind. |
Unless you control this behaviour directly at the webserver, you're leaving it up to the user's browser to decide whether they want to observe the redirect or not.
Personally, my web host offers a good menu selection options screen where i can set this behaviour at the web server level. (In case you're wondering, it just adds/changes a line to a config file in a specific directory on the server). If however you have direct access to the web server then you may want to read up on how to configure it. Search online and you should find some great tutorials, FAQ's, walkthroughs, etc. You'll find this a much more powerful way to do things so i hope you do have this option open to you. Welcome to tilted programming :) |
I will usually set up a redirect default.asp page. This way I can call a redirect to any directory on my site that I want.
response.redirect "[pagename]" |
All times are GMT -8. The time now is 04:42 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project