Htaccess: Redirect: Difference between revisions

Jump to navigation Jump to search
m
Reverted edits by Upazixorys (Talk); changed back to last version by Ric
No edit summary
m (Reverted edits by Upazixorys (Talk); changed back to last version by Ric)
Line 1: Line 1:
----
<span id="top"></span>
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
<div style="padding:0;margin:0; border-bottom:3px inset #000000">
----
=[http://ozoqemuvo.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]=
----
=[http://ozoqemuvo.co.cc CLICK HERE]=
----
</div>
&lt;span id=&quot;top&quot;&gt;&lt;/span&gt;
&lt;div style=&quot;padding:0;margin:0; border-bottom:3px inset #000000&quot;&gt;
{|  
{|  
|[[Image:uc_small_logo.gif | MPG UniCenter]] ||
|[[Image:uc_small_logo.gif | MPG UniCenter]] ||
Line 19: Line 11:


|}
|}
&lt;/div&gt;
</div>
{| cellpadding=&quot;2&quot;
{| cellpadding="2"
|
|
__TOC__
__TOC__
Line 38: Line 30:
Looking at this in a little more detail using this example
Looking at this in a little more detail using this example


'''Redirect /olddirectory/oldfile.html &lt;nowiki&gt;http://yoursite.com/newdirectory/newfile.html&lt;/nowiki&gt;'''
'''Redirect /olddirectory/oldfile.html <nowiki>http://yoursite.com/newdirectory/newfile.html</nowiki>'''
&lt;ol&gt;
<ol>
&lt;li&gt; '''Redirect'''
<li> '''Redirect'''
* This is the Apache command followed by a space
* This is the Apache command followed by a space
&lt;li&gt; '''/olddirectory/oldfile.html'''
<li> '''/olddirectory/oldfile.html'''
* This is the path to the old file you want redirected
* This is the path to the old file you want redirected
* It is stated in a relative file format
* It is stated in a relative file format
* Again followed by a space
* Again followed by a space
&lt;li&gt; '''&lt;nowiki&gt;http://yoursite.com/newdirectory/newfile.html&lt;/nowiki&gt;'''
<li> '''<nowiki>http://yoursite.com/newdirectory/newfile.html</nowiki>'''
* This is the full (URL) path of the location you want the request redirected to
* This is the full (URL) path of the location you want the request redirected to
&lt;/ol&gt;
</ol>


You would place a Redirect command in the root htaccess file for each file you want to redirect.
You would place a Redirect command in the root htaccess file for each file you want to redirect.
Line 55: Line 47:
Suppose that all you have done is renamed a folder (and even moved it to another location) however all the files still have their original names redirecting a folder is similar to the above for example:
Suppose that all you have done is renamed a folder (and even moved it to another location) however all the files still have their original names redirecting a folder is similar to the above for example:


'''Redirect /olddirectory &lt;nowiki&gt;http://yoursite.com/newdirectory&lt;/nowiki&gt;'''
'''Redirect /olddirectory <nowiki>http://yoursite.com/newdirectory</nowiki>'''
&lt;ol&gt;
<ol>
&lt;li&gt; '''Redirect'''
<li> '''Redirect'''
* This is the Apache command followed by a space
* This is the Apache command followed by a space
&lt;li&gt; '''/olddirectory'''
<li> '''/olddirectory'''
* This is the path to the old directory you want redirected
* This is the path to the old directory you want redirected
* It is stated in a relative file format
* It is stated in a relative file format
* Again followed by a space
* Again followed by a space
&lt;li&gt; '''&lt;nowiki&gt;http://yoursite.com/newdirectory&lt;/nowiki&gt;'''
<li> '''<nowiki>http://yoursite.com/newdirectory</nowiki>'''
* This is the full (URL) path of the location you want the request redirected to
* This is the full (URL) path of the location you want the request redirected to
&lt;/ol&gt;
</ol>


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
Line 72: Line 64:


{|
{|
|-style=&quot;background:#cccccc&quot;
|-style="background:#cccccc"
!Comment
!Comment
!Code
!Code
|-style=&quot;background:#f9f9f9&quot;
|-style="background:#f9f9f9"
|
|
# Navigate to the root folder '''www'''.
# Navigate to the root folder '''www'''.
Line 82: Line 74:
# Save the file
# Save the file
|
|
&lt;pre style=&quot;padding:4px;margin:0;border:none&quot;&gt;
<pre style="padding:4px;margin:0;border:none">
# This file provides security to the server limiting access to the localhost only.
# This file provides security to the server limiting access to the localhost only.
# Comment to deactivate.
# Comment to deactivate.
Line 98: Line 90:
# Defaults: Username = admin; Password = userver
# Defaults: Username = admin; Password = userver


#AuthName &quot;Uniform Server - Secure Server Access&quot;
#AuthName "Uniform Server - Secure Server Access"
#AuthType Basic
#AuthType Basic
#AuthUserFile /htpasswd/www/.htpasswd
#AuthUserFile /htpasswd/www/.htpasswd
Line 104: Line 96:


Redirect /old http://localhost/moved
Redirect /old http://localhost/moved
&lt;/pre&gt;
</pre>
|}
|}


Line 110: Line 102:


# Run the server using Server_Start.bat
# Run the server using Server_Start.bat
# In the browser address bar type '''&lt;nowiki&gt;http:/localhost/old&lt;/nowiki&gt;'''
# In the browser address bar type '''<nowiki>http:/localhost/old</nowiki>'''
# You will be redirected to the folder '''&lt;nowiki&gt;http://localhost/moved/&lt;/nowiki&gt;'''
# You will be redirected to the folder '''<nowiki>http://localhost/moved/</nowiki>'''


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
Line 119: Line 111:
'''Testing'''
'''Testing'''
# Run the server using Server_Start.bat
# Run the server using Server_Start.bat
# In the browser address bar type '''&lt;nowiki&gt;http:/localhost/old/not_found.html&lt;/nowiki&gt;'''
# In the browser address bar type '''<nowiki>http:/localhost/old/not_found.html</nowiki>'''
# You will be redirected to the file '''&lt;nowiki&gt;http://localhost/moved/not_found.html&lt;/nowiki&gt;'''
# You will be redirected to the file '''<nowiki>http://localhost/moved/not_found.html</nowiki>'''


Well you get the idea experiment with files it is similar to the folder example.
Well you get the idea experiment with files it is similar to the folder example.
Line 130: Line 122:
Below is a small extract from my .htaccess file you will see I am using page redirection:  
Below is a small extract from my .htaccess file you will see I am using page redirection:  


&lt;pre&gt;
<pre>
Redirect /us_35_apps/joomla/joomla_install_1.html http://wiki.uniformserver.com/index.php/Installing_Joomla
Redirect /us_35_apps/joomla/joomla_install_1.html http://wiki.uniformserver.com/index.php/Installing_Joomla
Redirect /us_35_apps/joomla/joomla_install_2.html http://wiki.uniformserver.com/index.php/Joomla_Portability
Redirect /us_35_apps/joomla/joomla_install_2.html http://wiki.uniformserver.com/index.php/Joomla_Portability
Line 140: Line 132:
Redirect /new_users/new_users_install_1.html http://wiki.uniformserver.com/index.php/New_Users:_Quick_Install_Guide
Redirect /new_users/new_users_install_1.html http://wiki.uniformserver.com/index.php/New_Users:_Quick_Install_Guide
Redirect /new_users/problems_1.html http://wiki.uniformserver.com/index.php/New_Users:_Problems_Section
Redirect /new_users/problems_1.html http://wiki.uniformserver.com/index.php/New_Users:_Problems_Section
&lt;/pre&gt;
</pre>


'''''Tip'':''' I first publish the Wiki pages, use a browser to view a page and copy the link into .htaccess. Similar process to obtain the redirected page.
'''''Tip'':''' I first publish the Wiki pages, use a browser to view a page and copy the link into .htaccess. Similar process to obtain the redirected page.
Line 146: Line 138:
=== Errors ===
=== Errors ===
Any typos in the .htaccess file will cause Apache to spit out the following error message:
Any typos in the .htaccess file will cause Apache to spit out the following error message:
&lt;pre&gt;
<pre>
Internal Server Error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
The server encountered an internal error or misconfiguration and was unable to complete your request.
&lt;/pre&gt;
</pre>


Hence always make small changes to .htaccess and then test, makes it easier to isolate and resolve any problems.
Hence always make small changes to .htaccess and then test, makes it easier to isolate and resolve any problems.

Navigation menu