Solved

redirect at GoDaddy hosting

Posted on 2010-09-22
13
463 Views
Last Modified: 2012-05-10
I am trying to move the current web site content to a subdirectory.  I am not sure how I can point user to the new location.
For example
when user type
http://www.web.ca  
it actually direct it to
http://www.web.ca/index.php

Now I would like to point to
http://www.web.ca/old/index.php


0
Comment
Question by:tommym121
  • 3
  • 3
  • 2
  • +3
13 Comments
 
LVL 7

Expert Comment

by:myhc
Comment Utility
This is because of the default files to load section within a web site.  You need a new index.php with a redirect sting inside it point to new location.
0
 

Author Comment

by:tommym121
Comment Utility
How to write a redirect string
0
 
LVL 30

Expert Comment

by:Marco Gasi
Comment Utility
In index.php write

<?php
header("Location: http://www.web.ca/old/index.php");
?>

Cheers
0
 
LVL 7

Expert Comment

by:myhc
Comment Utility
0
 
LVL 3

Expert Comment

by:guitar7man
Comment Utility
You can also change the wwwroot folder within the GoDaddy portal to "old" if you don't want the URL to look like /old/index.php (will look like it did before, just index.php). Not sure if that's what you're going for, but you can do it by logging into GoDaddy, going into your web hosting management, and adjusting the web root settings.
0
 
LVL 7

Expert Comment

by:myhc
Comment Utility
wish tis had been and ASP questionm Thats easy..

<%response.redirect("http://host.com")%>
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 7

Accepted Solution

by:
ziceva earned 500 total points
Comment Utility
This could be done with apache's RewriteEngine.

In the document root (outside of the "old" subfolder) create a .htaccess file with this lines in it:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !old
RewriteRule (.*) old/$1
0
 
LVL 30

Expert Comment

by:Marco Gasi
Comment Utility
I try to be more clear:

when you type http://www.web.ca  user is redirected to http://www.web.ca/index.php because index.php is the deafult file that browsers load when you omit to specify a file name after the domain (this if index.htm/index.html doesn't exist).

So to get desired result to redirect your user to http://www.web.ca/old/index.php you have to delete or rename actual index.php in http://www.web.ca and replace it with a new index.php where you have to write only the three lines of code I said above:

<?php
header("Location: http://www.web.ca/old/index.php");
?>

This does the trick.

Cheers
0
 
LVL 17

Expert Comment

by:nanharbison
Comment Utility
Why don't you have godaddy do the rediect. You go to Domain Manager -> clcik on the checkbox fin front of the domain you want to redirect, at the top of the domain list, there is the option to 'forward" the domain to a different URL
0
 

Author Comment

by:tommym121
Comment Utility
I try to go to go daddy to do it.  It give me the error below

This webpage has a redirect loop.

The webpage at http://www.web.com/old/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phpold/home.phphome.php has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
0
 
LVL 17

Expert Comment

by:nanharbison
Comment Utility
Oh wait, I didn't read your being more clear post, this  is irrelevant, sorry!
0
 
LVL 7

Expert Comment

by:ziceva
Comment Utility
The header("Location:") solution will only do redirects like:
http://www.web.ca > http://www.web.ca/old/index.php
and
http://www.web.ca/index.php > http://www.web.ca/old/index.php

If you have http://www.web.ca/contact.php, it will not redirect to http://www.web.ca/old/contact.php unless you create a contact.php file in the document root similar to index.php

When using .htaccess, any file a user tries to access will be looked for in the old/ folder
0
 

Author Closing Comment

by:tommym121
Comment Utility
Thanks.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now