IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

How To Redirect From One Page To Another?

, type a url but it directs to another url


vietonline
no avatar
Advanced Member
*******
Group: Members
Posts: 127
Joined: 10-July 06
Member No.: 26,374



Post #1 post Aug 12 2006, 04:49 AM
I want to do something like this.
I have open a forum, and my forum at this address www.domain.com/forum/ ,but I want my member type only www.domain.com then it will direct them to this address www.domain.com/forum/
anyone know how to do it,can you help me with this?
Go to the top of the page
+Quote Post
BuffaloHelp
no avatar
More than meets the eye
******************
Group: Admin
Posts: 3,762
Joined: 23-April 05
From: Trap17 storage box
Member No.: 6,042
myCENT:49.00



Post #2 post Aug 12 2006, 05:35 AM
Make index.php file with code:

CODE
<?php
header ("Location: http://www.domain.com/forums");
?>


or make index.html (or index.htm) with code:

HTML
<meta http-equiv="refresh" content="2;url=http://www.domain.com/forums">


where 2 denotes the time in seconds before it directs. Nice if you want to show a message "you're being redirected to another page in X seconds"
Go to the top of the page
+Quote Post
lemonwonder
no avatar
Super Member
*********
Group: Members
Posts: 344
Joined: 28-July 06
Member No.: 27,449



Post #3 post Aug 12 2006, 05:37 AM
or go into cpanel,

and then scroll down to web tools (I think tis web tools) and then click manage redirects,
Go to the top of the page
+Quote Post
Paul
no avatar
Premium Member
********
Group: Members
Posts: 174
Joined: 25-February 06
From: Austin, TX
Member No.: 19,113
myCENT:ZERO



Post #4 post Aug 12 2006, 02:55 PM
You can use .htaccess to achieve this while pleasing the Search Engines as well.

Create a file (if it doesnt already exist) called .htaccess and add the following code to the .htaccess file and then place the .htaccess file in your public_html folder.
CODE

Options +FollowSymlinks
RewriteEngine on
rewriterule ^www.domain.com$ [url=http://www.domain.com/forum]http://www.domain.com/forum[/url] [r=301,nc]
rewriterule ^domain.com$ [url=http://www.domain.com/forum]http://www.domain.com/forum[/url] [r=301,nc]


What this does this that it redirects www.domain.com to www.domain.com/forum and tells the Search Engines that the homepage has permanently moved to the new page (forums).

Please REPLACE domain.com and with your actual domain name.

Note: This method of using .htaccess only works on Apache servers with mod_rewrite enabled (If you use Trap17 you will be fine!)

This post has been edited by Paul: Aug 12 2006, 02:56 PM
Go to the top of the page
+Quote Post
delivi
no avatar
Trap Grand Marshal Member
***********
Group: [HOSTED]
Posts: 1,320
Joined: 11-January 06
Member No.: 16,932
myCENT:NEGATIVE[-455.29]



Post #5 post Aug 12 2006, 06:33 PM
Automatic Redirection using HTML Tag

CODE
Put this code inbetween the <head> and </head> tags.
<META HTTP-EQUIV="Refresh" CONTENT="n;URL=http://your_url">
Where 'n' is the number of seconds to wait before redirection. Set it to '0' if you dont want to wait.

Put the url where you want to be redirected by replacing the 'your_url'


Redirection Using JavaScript

CODE
Put this code any where between the <head> and </head> tags.

<script LANGUAGE="JavaScript"><!--
    window.location.href = "your_url"; -->
</SCRIPT>

Put the url where you want to be redirected by replacing the 'your_url'



Go to the top of the page
+Quote Post
lemonwonder
no avatar
Super Member
*********
Group: Members
Posts: 344
Joined: 28-July 06
Member No.: 27,449



Post #6 post Aug 12 2006, 09:00 PM
Or possibly like i sed, the simplest and easiest, leastr time consuming way, and its easy to keep track on is using Managte Redirects!
Go to the top of the page
+Quote Post
vietonline
no avatar
Advanced Member
*******
Group: Members
Posts: 127
Joined: 10-July 06
Member No.: 26,374



Post #7 post Aug 13 2006, 01:47 AM
QUOTE(Paul @ Aug 12 2006, 07:55 AM) [snapback]273543[/snapback]

You can use .htaccess to achieve this while pleasing the Search Engines as well.

Create a file (if it doesnt already exist) called .htaccess and add the following code to the .htaccess file and then place the .htaccess file in your public_html folder.
CODE

Options +FollowSymlinks
RewriteEngine on
rewriterule ^www.domain.com$ [url=http://www.domain.com/forum]http://www.domain.com/forum[/url] [r=301,nc]
rewriterule ^domain.com$ [url=http://www.domain.com/forum]http://www.domain.com/forum[/url] [r=301,nc]


What this does this that it redirects www.domain.com to www.domain.com/forum and tells the Search Engines that the homepage has permanently moved to the new page (forums).

Please REPLACE domain.com and with your actual domain name.

Note: This method of using .htaccess only works on Apache servers with mod_rewrite enabled (If you use Trap17 you will be fine!)


I did it ,but it didn't work.I already change the domain name with my actual domain name.But I like this code to much can you please figure out why it doesn't work. thanks

This post has been edited by vietonline: Aug 13 2006, 04:44 AM
Go to the top of the page
+Quote Post
farsiscript
no avatar
Super Member
*********
Group: Members
Posts: 357
Joined: 8-April 06
Member No.: 21,487



Post #8 post Aug 14 2006, 07:21 AM
Hi dear vietonline at first login at cpanel
then click at Manage Redirects and then
leave textbox one and type in textbox two your forum address and then click at add




or you can find many javascript code for redirect :

CODE
<html>
<script>
    location = "http://www.i-code.co.uk/index.php";
</script>
</html>

or use php redirect code :
CODE
<?php
$forum = "Your Forum address " // like [url=http://yourdomain.com/forum]http://yourdomain.com/forum[/url]
header ("Location: $forum");
?>


This post has been edited by farsiscript: Aug 14 2006, 07:23 AM
Go to the top of the page
+Quote Post
vietonline
no avatar
Advanced Member
*******
Group: Members
Posts: 127
Joined: 10-July 06
Member No.: 26,374



Post #9 post Aug 16 2006, 01:15 AM
To farsiscript:

Thank you so much,this is the way that I want to do,and with the way you show me ,it is so easy to do.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No new 26 templest 31,357 15th June 2009 - 07:12 AM
Last post by: gannimel
No New Posts   6 galexcd 1,264 27th June 2007 - 03:56 PM
Last post by: alex7h3pr0gr4m3r
No New Posts   5 saitunes 1,325 26th September 2008 - 12:35 AM
Last post by: jlhaslip
No New Posts   10 spawn_syxx9 10,411 10th September 2004 - 06:08 AM
Last post by: wassie
No new 15 truvu17 5,680 20th September 2004 - 05:34 PM
Last post by: NeXDesigns
No New Posts   2 SEOClark 1,171 23rd February 2007 - 07:19 AM
Last post by: SEOClark
No New Posts 0 nirvana43 1,246 7th July 2006 - 04:17 PM
Last post by: nirvana43
No New Posts   3 Casanova 4,568 22nd October 2004 - 02:59 PM
Last post by: ashiezai
No New Posts   1 Oni_BlueEyes 4,184 27th November 2007 - 12:08 PM
Last post by: rigueira
No New Posts 12 cman500 12,640 25th October 2006 - 02:29 PM
Last post by: jlhaslip
No New Posts   10 Spectre 14,001 6th December 2004 - 02:42 AM
Last post by: icedragn
No New Posts   3 Mario 5,567 24th November 2004 - 03:27 PM
Last post by: ashiezai
No New Posts   3 Darth Vivi 9,571 1st December 2004 - 03:51 AM
Last post by: Darth Vivi
No New Posts   10 Good Grief Graphics 9,906 10th December 2004 - 09:07 PM
Last post by: Good Grief Graphics
No New Posts   7 cragllo 6,991 2nd September 2006 - 10:16 AM
Last post by: masterio


 



RSS Open Discussion Time is now: 8th November 2009 - 03:25 AM

Web Hosting Powered by ComputingHost.com.