Difference between revisions of "Redirect Your Webpage To Another Website"

 
(40 intermediate revisions by 2 users not shown)
Line 1: Line 1:
You want to take your personal website on our server
+
==INTRO==
  
::'''<nowiki>http://www.cs.jhu.edu/~mary</nowiki>'''
+
:You want to take your personal website on our server, for example:  
  
and have all requests for that site get redirected to another website
+
:::your Grad/Research account's webpage: '''<nowiki>http://www.cs.jhu.edu/~mary</nowiki>'''
  
::'''<nowiki>http://some-other-webserver.com/~mary</nowiki>'''
+
:::::or
  
You can do this by adding a line to the '''''.htaccess''''' file in your ''public_html'' directory.
+
::: your Ugrad account's web page: '''<nowiki>http://ugrad.cs.jhu.edu/~mary</nowiki>'''
  
'''NOTE:''' There are some important things already in the .htaccess file that
+
:and have all requests for your page ''redirected'' to another website, for example:
make ''PHP'' work on our systems.  Please do erase that code from the file.  Just add the following line.
 
  
 +
:::'''<nowiki>http://some-other-webserver.com/~mary</nowiki>'''
  
The line to should look similar to this:
+
==Method To Redirect Your Personal CS Webpage To A Different Site==
  
::'''Redirect &nbsp;307 &nbsp;/~mary/&nbsp;&nbsp; <nowiki>http://some-other-webserver.com/~mary/</nowiki>'''
+
:'''Add a ''redirect'' line''' to the '''''.htaccess''''' file in your ''public_html'' directory on your Grad and/or Ugrad account, depending on which URL above you want to use. (Remember, if you have both a Grad and a Ugrad account, and you want to have the redirect work for both, you need to follow the following instructions ''for both accounts''.)
  
 +
:<span style="color:#ff0000">'''IMPORTANT!''' There are some ''special lines of code'' already in the .htaccess file that make ''PHP'' work on our systems.  Please '''''do not erase''''' that code from the file.  Just add the following '''Redirect''' line. </span>
  
In the example above, anyone surfing to '''<nowiki>http://www.cs.jhu.edu/~mary</nowiki>''' will get redirected to '''<nowiki>http://some-other-webserver.com/~mary</nowiki>'''
+
:The '''Redirect''' line to should look similar to this:
  
 +
::<code>Redirect  307  /~mary  <nowiki>http://some-other-webserver.com/~mary</nowiki></code>
  
You can change the redirection at any time simply by editing the .htaccess
+
:In the example above, anyone surfing to '''<nowiki>http://www.cs.jhu.edu/~mary</nowiki>''' (Grad account) or to '''<nowiki>http://ugrad.cs.jhu.edu/~mary</nowiki>''' (Ugrad account) will get redirected to '''<nowiki>http://some-other-webserver.com/~mary</nowiki>'''
file. However...
 
  
'''NOTE 1:''' If you want to stop the redirection you need to remove your '''Redirect''' line from the file.  Do not remove other existing lines from the file.  
+
:You can ''change'' or ''remove'' the redirection at any time simply by editing the .htaccess file.  However...
 +
 
 +
===NOTES:===
 +
 
 +
::* If you want to ''stop/remove'' the redirection you need to remove your '''Redirect''' line from the '''.htaccess''' file.  '''''Do not''''' remove the other existing lines from the file.
 +
 
 +
::* Please<span style="color:#ff0000"> '''''do not''''' delete the '''.htaccess''' file.</span>  If you do, you'll break PHP.
  
'''NOTE 2:'''  Please '''''do not''''' delete the '''.htaccess''' file.  If you do, you'll break PHP.
 
  
  
  
 
[[Category:Webpages and Webservices]]
 
[[Category:Webpages and Webservices]]

Latest revision as of 15:45, 6 December 2017

INTRO

You want to take your personal website on our server, for example:
your Grad/Research account's webpage: http://www.cs.jhu.edu/~mary
or
your Ugrad account's web page: http://ugrad.cs.jhu.edu/~mary
and have all requests for your page redirected to another website, for example:
http://some-other-webserver.com/~mary

Method To Redirect Your Personal CS Webpage To A Different Site

Add a redirect line to the .htaccess file in your public_html directory on your Grad and/or Ugrad account, depending on which URL above you want to use. (Remember, if you have both a Grad and a Ugrad account, and you want to have the redirect work for both, you need to follow the following instructions for both accounts.)
IMPORTANT! There are some special lines of code already in the .htaccess file that make PHP work on our systems. Please do not erase that code from the file. Just add the following Redirect line.
The Redirect line to should look similar to this:
Redirect 307 /~mary http://some-other-webserver.com/~mary
In the example above, anyone surfing to http://www.cs.jhu.edu/~mary (Grad account) or to http://ugrad.cs.jhu.edu/~mary (Ugrad account) will get redirected to http://some-other-webserver.com/~mary
You can change or remove the redirection at any time simply by editing the .htaccess file. However...

NOTES:

  • If you want to stop/remove the redirection you need to remove your Redirect line from the .htaccess file. Do not remove the other existing lines from the file.
  • Please do not delete the .htaccess file. If you do, you'll break PHP.