• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 474
  • Last Modified:

redirect at GoDaddy hosting

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
tommym121
Asked:
tommym121
  • 3
  • 3
  • 2
  • +3
1 Solution
 
myhcCommented:
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
 
tommym121Author Commented:
How to write a redirect string
0
 
Marco GasiFreelancerCommented:
In index.php write

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

Cheers
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
myhcCommented:
0
 
guitar7manCommented:
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
 
myhcCommented:
wish tis had been and ASP questionm Thats easy..

<%response.redirect("http://host.com")%>
0
 
zicevaCommented:
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
 
Marco GasiFreelancerCommented:
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
 
nanharbisonCommented:
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
 
tommym121Author Commented:
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
 
nanharbisonCommented:
Oh wait, I didn't read your being more clear post, this  is irrelevant, sorry!
0
 
zicevaCommented:
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
 
tommym121Author Commented:
Thanks.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

  • 3
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now