NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page How can I redirect my home page to another part of my site?

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

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-04-2007, 03:32 PM THREAD STARTER               #1 (permalink)
NamePros Regular
Join Date: Dec 2006
Posts: 308
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, 03:42 PM   #2 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
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, 04:02 PM THREAD STARTER               #3 (permalink)
NamePros Regular
Join Date: Dec 2006
Posts: 308
twells22 is an unknown quantity at this point
 



Thanks, that did it!
twells22 is offline  
Old 05-04-2007, 04:39 PM   #4 (permalink)
NamePros Regular
Join Date: Feb 2007
Posts: 245
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, 06:13 PM THREAD STARTER               #5 (permalink)
NamePros Regular
Join Date: Dec 2006
Posts: 308
twells22 is an unknown quantity at this point
 



I'm always interested in learning. Sure!
twells22 is offline  
Old 05-04-2007, 11:38 PM   #6 (permalink)
NamePros Regular
 
monaco's Avatar
Join Date: Jul 2005
Location: Tucson, AZ
Posts: 689
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, 03:04 AM   #7 (permalink)
NamePros Member
 
jabba_29's Avatar
Join Date: Mar 2007
Location: Finland
Posts: 29
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, 06:23 AM   #8 (permalink)
NamePros Regular
Join Date: Feb 2007
Posts: 245
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, 08:59 AM   #9 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
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, 09:05 AM THREAD STARTER               #10 (permalink)
NamePros Regular
Join Date: Dec 2006
Posts: 308
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, 09:12 AM   #11 (permalink)
NamePros Regular
Join Date: Feb 2007
Posts: 245
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, 09:18 AM   #12 (permalink)
NamePros Member
 
jabba_29's Avatar
Join Date: Mar 2007
Location: Finland
Posts: 29
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, 09:45 AM THREAD STARTER               #13 (permalink)
NamePros Regular
Join Date: Dec 2006
Posts: 308
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 09:50 AM.
twells22 is offline  
Old 05-06-2007, 03:09 AM   #14 (permalink)
NamePros Member
 
jabba_29's Avatar
Join Date: Mar 2007
Location: Finland
Posts: 29
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, 03:32 AM THREAD STARTER               #15 (permalink)
NamePros Regular
Join Date: Dec 2006
Posts: 308
twells22 is an unknown quantity at this point
 



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, 02:13 PM   #16 (permalink)
NamePros Regular
 
monaco's Avatar
Join Date: Jul 2005
Location: Tucson, AZ
Posts: 689
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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 11:57 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger