Home : OpenEdit SDK : Programming OpenEdit : Redirect Pages
Redirect Pages
A browser can be redirected to other pages in several ways. These redirects are permanent redirects that the web crawlers will follow to index your site.
Redirect Action
The easy way is to use to setup an action such as _default.xconf:
<page><path-action name="Admin.redirect">
<redirectpath>/tmp/*</redirectpath>
</path-action>
</page>
This will redirect every page in a directory to the /tmp/ directory. The file names in the tmp directory must match that the browser is looking for.
To make all the files be redirected to a certain file you can use:
<redirectpath>/tmp/moved.html</redirectpath>
You can also send all the hits to another domain name such as:
<redirectpath>http://www.acme.com/</redirectpath>
This will include any path information if the page exists. Otherwise it will redirect to the root level
Scripting Action
You can create a scipt such as this /forward.js
importPackage( Packages.java.util );
importPackage( Packages.java.lang );
if( user.getUserName() == "cburkey" )
{
context.redirect("/cburkeyindex.html");
}
Then add this action to /index.xconf:
<page>
<path-action name="Script.run" >
<script>/forward.js</script>
</path-action>
</page>
