Solved

redirect at GoDaddy hosting

Posted on 2010-09-22
13
464 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
 
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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Password forgotten. 3 39
only allow numbers with preg match 4 24
WP_Query multiple custom taxonomies 5 23
Scope of $_SESSION 15 0
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

947 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

21 Experts available now in Live!

Get 1:1 Help Now