r2 - 15 May 2009 - 03:20:50 - PorchLightYou are here: TWiki >  Main Web > ApacheRedirects

ApacheRedirects

Redirect

This is a basic redirect. It redirects one page to another. In the case of this site, this is what is used bring up the twiki site as the front page. Add to .htaccess
Redirect permanent /index.html http://4096k.net/cgi-bin/twiki/bin/view/Main/WebHome
This does not rewrite the URL. Just a simple redirect.

Mod Rewrite

This uses Apache mod_rewrite to do about the same thing, but mod_rewrite may not be turned on in the server.
RewriteEngine on
RewriteRule ^/$ /cgi-bin/twiki/bin/view/Main/WebHome/ [R]

Mod Rewrite V2

My webhost seems to have issues with some RewriteRules? . In addition, the IRMs on this account cause other problems with the above Mod Rewrite. He is what I am currently using.

RewriteEngine on

#change www to none www url
RewriteCond %{HTTP_HOST} ^www.4096k.net
RewriteRule (.+) http://4096k.net/$1 [R=301,L]


#redirect for twiki, ya it's a hack
RewriteCond %{REQUEST_FILENAME} !twiki
RewriteCond %{HTTP_HOST} ^4096k\.net
RewriteRule ^(.*)$ http://4096k.net/cgi-bin/twiki/bin/view/Main/WebHome [R=301,L]
This has it's own problems. The first ReWriteCond? checks to see if the word "twiki" is NOT in the URL and the second checks to make sure it's on the host 4096k.net. Then rewrite the url to the longer twiki url. This works, but will fail when when files are called outside the "twiki" directory.

-- PorchLight - 01 Sep 2007

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions

tip TWiki Tip of the Day
Breadcrumb
The breadcrumb of a topic shows you page hierarchy. It is constructed using a topic's parent setting ... Read on Read more

 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback