[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 05-04-2007, 02:32 PM   #1 (permalink)
NamePros Regular
 
Join Date: Dec 2006
Posts: 300
0.00 NP$ (Donate)

twells22 is an unknown quantity at this point


How can I redirect my home page to another part of my site?

Ok I am using Godaddy's hosting and my main domain is say lll.com. Well I installed joomla on it at lll.com/h. When people type in lll.com I need them to be redirected to lll.com/h. I was using a JavaScript code to do it with other sites but this site doesn't support Java. I can't simply forward the domain either because it will change the nameservers. What do I do?
twells22 is offline  
Old 05-04-2007, 02:42 PM   #2 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future

Autism Autism Autism Autism Autism Autism Autism
You don't need Java to use JavaScript. JS is completely browser dependent, though, so another choice is still better.

You could add the following line of code to your site:
Code:
<meta http-equiv="REFRESH" content="0;url=http://www.lll.com/h">
Dan is offline  
Old 05-04-2007, 03:02 PM   #3 (permalink)
NamePros Regular
 
Join Date: Dec 2006
Posts: 300
0.00 NP$ (Donate)

twells22 is an unknown quantity at this point


Thanks, that did it!
twells22 is offline  
Old 05-04-2007, 03:39 PM   #4 (permalink)
NamePros Regular
 
Join Date: Feb 2007
Posts: 245
84.00 NP$ (Donate)

groundctrl will become famous soon enoughgroundctrl will become famous soon enough


another way is to do a 302 redirect via your .htaccess file... that way, it doesn't count as two page views... (one for the old one, one for the new one). let me know if you want to know how to do this.
groundctrl is offline  
Old 05-04-2007, 05:13 PM   #5 (permalink)
NamePros Regular
 
Join Date: Dec 2006
Posts: 300
0.00 NP$ (Donate)

twells22 is an unknown quantity at this point


I'm always interested in learning. Sure!
twells22 is offline  
Old 05-04-2007, 10:38 PM   #6 (permalink)
NamePros Regular
 
monaco's Avatar
 
Join Date: Jul 2005
Location: Tucson, AZ
Posts: 695
314.80 NP$ (Donate)

monaco will become famous soon enough


You can also use mod_rewrite to do the job.
__________________
My Website | My Blog
monaco is offline  
Old 05-05-2007, 02:04 AM   #7 (permalink)
NamePros Member
 
jabba_29's Avatar
 
Join Date: Mar 2007
Location: Finland
Posts: 29
5.00 NP$ (Donate)

jabba_29 is an unknown quantity at this point


.htaccess redirects or mod_rewrite are most definitely better options than meta refresh.
Some devices don't support it and it can be blocked too....
__________________
Regards Jamie

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.
jabba_29 is offline  
Old 05-05-2007, 05:23 AM   #8 (permalink)
NamePros Regular
 
Join Date: Feb 2007
Posts: 245
84.00 NP$ (Donate)

groundctrl will become famous soon enoughgroundctrl will become famous soon enough


here you go. This goes inside your .htaccess file:

Redirect 302 /file.html http://www.example.com/new_file.html

obviously, in the first case you don't include the domain, just the directory and filename, but in the second case you include the full one. making it a 302 means it's a temporary redirect, and changing that to 301 means it would be a permanent one.
groundctrl is offline  
Old 05-05-2007, 07:59 AM   #9 (permalink)
Barru.
 
Barrucadu's Avatar
 
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,731
78.50 NP$ (Donate)

Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold


Of course you could have just installed joomla in the site root, rather than a subdirectory. I don't suppose it would be too hard to move it (I don't know a think about joomla though)
Barrucadu is offline  
Old 05-05-2007, 08:05 AM   #10 (permalink)
NamePros Regular
 
Join Date: Dec 2006
Posts: 300
0.00 NP$ (Donate)

twells22 is an unknown quantity at this point


How do I do it because its not working. I put this by itself in a .htaccess file

Redirect 301 /index.html http://www.example.com/h/

Then uploaded it to the main directory. What am I doing wrong?
twells22 is offline  
Old 05-05-2007, 08:12 AM   #11 (permalink)
NamePros Regular
 
Join Date: Feb 2007
Posts: 245
84.00 NP$ (Donate)

groundctrl will become famous soon enoughgroundctrl will become famous soon enough


does your htaccess file begin with:

<IfModule mod_rewrite.c>
RewriteEngine On

because i believe that's how it's supposed to begin.
groundctrl is offline  
Old 05-05-2007, 08:18 AM   #12 (permalink)
NamePros Member
 
jabba_29's Avatar
 
Join Date: Mar 2007
Location: Finland
Posts: 29
5.00 NP$ (Donate)

jabba_29 is an unknown quantity at this point


Depending on what you have index already on your site, you probably want everything in your root directory to be directed to your h directory??

To do this try something like:
Code:
RedirectMatch permanent ^(.*)$ /h$1
__________________
Regards Jamie

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.
jabba_29 is offline  
Old 05-05-2007, 08:45 AM   #13 (permalink)
NamePros Regular
 
Join Date: Dec 2006
Posts: 300
0.00 NP$ (Donate)

twells22 is an unknown quantity at this point


jabba*
When I did that it sent everything to example.com/h/h/h/h/h/h/h/h/h/h/

But I got it to work with groundcntrl's tip. Thanks

Last edited by twells22; 05-05-2007 at 08:50 AM.
twells22 is offline  
Old 05-06-2007, 02:09 AM   #14 (permalink)
NamePros Member
 
jabba_29's Avatar
 
Join Date: Mar 2007
Location: Finland
Posts: 29
5.00 NP$ (Donate)

jabba_29 is an unknown quantity at this point


Oops, sirry. Untested.
Perhaps putting another condition in your h directory would sort it.
Or checking that h doesn't exist in your first comparison.

Butanyway, glad you got it sorted.
__________________
Regards Jamie

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.
jabba_29 is offline  
Old 05-06-2007, 02:32 AM   #15 (permalink)
NamePros Regular
 
Join Date: Dec 2006
Posts: 300
0.00 NP$ (Donate)

twells22 is an unknown quantity at this point


Quote:
Originally Posted by Mikor
Of course you could have just installed joomla in the site root, rather than a subdirectory. I don't suppose it would be too hard to move it (I don't know a think about joomla though)
Yea but I like to organize my files to where its easier for my to modify them with ftp. I have more than one site on this hosting account and it helps me to do it this way.
twells22 is offline  
Old 05-08-2007, 01:13 PM   #16 (permalink)
NamePros Regular
 
monaco's Avatar
 
Join Date: Jul 2005
Location: Tucson, AZ
Posts: 695
314.80 NP$ (Donate)

monaco will become famous soon enough


Does this work if you request /index.html as opposed to /? The redirect is handled before the default document directive is looked at...

Also, are you certain your server is configured with all the modules enabled needed to do this?
__________________
My Website | My Blog
monaco is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 01:36 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85