ULIX TxT Editor on Sourceforge.net






Create page and uri redirections


Creating a page redirect is very simple, that is if you know how! Follow these steps for an accurate Page Redirection. There are two different formats and both will be exampled below.



1. Homepage Redirections


The first Redirection is the HomePage Redirection. It looks like this:
# Redirect direct HP and Domain access to an HTTPS/SSL name
RewriteCond %{HTTP_HOST} ^yourdomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$
RewriteRule ^/?$ https://yourdomain.com/pageofchoice [R=301,L]
RewriteRule ^$ https://yourdomain.com/pageofchoice [R=301,L]



Note: Make sure you place this code after the Expiration header.


2. Permanent and Temporary Redirections


The next is a simple Page Redirect. This is used to relocate a page from one location to another using the domain's URL. It looks like this:
# Create a page Redirect [Permanent Redirect]
RewriteRule ^about$ /home.php [R=301,L]

# Create a page Redirect [Temporary Redirect]
RewriteRule ^about$ /home.html [R=302,L]



When creating a Redirection link it is important to note that R=301 indicates a PERMANENT Redirection and that R=302 indicates a TEMPORARY redirection. It Is important to note that you MUST indicate one of these two in the fields between two brackets"[ ]" in order for the redirection to take place. You must also follow the R=30x code with a ",L" in order to tell the server that this is a Link.