Revision [7750]

This is an old revision of ModRewrite made by JavaWoman on 2005-05-01 09:17:23.

 

WikkaDocumentation Wikka Documentation

Wikka and mod_rewrite


The Apache webserver has a module called mod_rewrite; mod_rewrite "rewrites" URLs so it can do things like translate the URL http://wikka.jsnx.com/DotMG into http://wikka.jsnx.com/wikka.php?wakka=DotMG. This gives us nice, short, and user-friendly URLs to use with Wikka while internally Wikka works with the "full" URL.

Wikka works with mod_rewrite. And Wikka works without mod_rewrite.

Requirements

  1. The major requirement is that Wikka is installed on a system with Apache as the web server. (Some other web servers, like lighttpd, support similar functionality, but go.microsoft.com/fwlink/?LinkId=7001 IIS definitely does not.)
  1. Also, mod_rewrite must be enabled (not the case on many hosted systems)
  1. Finally, either .htaccess configuration must be allowed (not the case on many hosted systems) - because Wikka by default uses .htaccess files in directories to enable/disable URL rewriting - or you must have root access and be able to edit the Apache configuration (httpd.conf) directly (only on dedicated servers or some virtual private/dedicated systems).

Configuration

During installation, Wikka will try to figure out if mod_rewrite is available. If Wikka does not detect mod_rewrite, it's possible to manually configure Wikka to use it after installation.

Follow this simple instruction:

Change these lines:
    "base_url" => "http://my.domain.com/wikka.php?wakka=",
    "rewrite_mode" => "0",


to this:
    "base_url" => "http://my.domain.com/",
    "rewrite_mode" => "1",


That's it. Notice the small change. We are just removing "wikka.php?wakka=" and then setting rewrite_mode to 1. Note that the two configuration settings must always match - if not, you'll end up with strange errors and pages not found.

Even if URL rewriting is used in Wikka, the long form of the URLs will continue working so you don't need to change any links with long URLs you may already have when switching to using mod_rewrite.

Troubleshooting

If after following the instruction above mod_rewrite is still not working, first make sure that Wikka is actually running on Apache. Creating a page with just
<?php phpinfo();?>
and calling this page up in the browser will give a host of information about the environment PHP is running in.

Hosted server
If your server is Apache, there are two possibile causes why mod_rewrite may not work: Either your web host does not have mod_rewrite configured so that you can use it, or .htaccess is ignored in directories. (You may try asking your host to enable both - if that doesn't work you'll have to do with long URLs.)

(Virtual) Private Server
If you are controlling your own server and mod_rewrite is enabled, there are two configuration options:
  1. Make sure .htaccess files in directories are supported. This is the easiest way to enable Wikka to use URL rewriting. Wikka uses a .htaccess for rewrite configuration in the installation directory as well as in the following subdirectories:
The .htaccess file in the installation directory enables mod_rewrite while the other ones disable it again because these directories contain files that are directly linked to from generated HTML pages.
  1. If you prefer, you can reproduce the rewriting rules for the installation directory (from the main .htaccess file) directly in your httpd.conf file. If you do this, make sure that either .htaccess is enabled for the mentioned subdirectories (and the .htaccess files are present there) or that you explicitly turn off rewriting in the subdirectories mentioned above by means of Directory directives.

Known issues

Some Apache versions for Windows have a bug that will lowercase all URLs when using mod_rewrite; this is a ModRewriteDevelopment problem in Wikka specifically when creating new pages. We're looking into the possibility of creating a workaround for this.


CategoryDocumentation
There are 32 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki