| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Dec 2006
Posts: 308
![]() | 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? |
| |
| | #2 (permalink) |
| Buy my domains. Join Date: Feb 2006
Posts: 2,796
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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"> |
| |
| | #7 (permalink) |
| NamePros Member Join Date: Mar 2007 Location: Finland
Posts: 29
![]() | .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. |
| |
| | #8 (permalink) |
| NamePros Regular Join Date: Feb 2007
Posts: 245
![]() ![]() | 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. |
| |
| | #9 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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) |
| |
| | THREAD STARTER #10 (permalink) |
| NamePros Regular Join Date: Dec 2006
Posts: 308
![]() | 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? |
| |
| | #12 (permalink) |
| NamePros Member Join Date: Mar 2007 Location: Finland
Posts: 29
![]() | 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. |
| |
| | #14 (permalink) |
| NamePros Member Join Date: Mar 2007 Location: Finland
Posts: 29
![]() | 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. |
| |
| | THREAD STARTER #15 (permalink) | ||||
| NamePros Regular Join Date: Dec 2006
Posts: 308
![]() |
| ||||
| |
| | #16 (permalink) |
| NamePros Regular Join Date: Jul 2005 Location: Tucson, AZ
Posts: 689
![]() | 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? |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |