Solved

redirect at GoDaddy hosting

Posted on 2010-09-22
13
466 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
ID: 33734571
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
ID: 33734579
How to write a redirect string
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 33734586
In index.php write

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

Cheers
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 7

Expert Comment

by:myhc
ID: 33734592
0
 
LVL 3

Expert Comment

by:guitar7man
ID: 33734607
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
ID: 33734608
wish tis had been and ASP questionm Thats easy..

<%response.redirect("http://host.com")%>
0
 
LVL 7

Accepted Solution

by:
ziceva earned 500 total points
ID: 33734700
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 31

Expert Comment

by:Marco Gasi
ID: 33734714
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
ID: 33734949
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
ID: 33734969
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
ID: 33734986
Oh wait, I didn't read your being more clear post, this  is irrelevant, sorry!
0
 
LVL 7

Expert Comment

by:ziceva
ID: 33735007
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
ID: 33735186
Thanks.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

839 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