12345678910 |
- version=pmwiki-0.6.15
- newline=²
- text=PmWiki is designed to be usable as a web site maintenance tool, and frequently administrators will want to be able to provide access to PmWiki pages without having "pmwiki.php" appear in the address bar of the users' browser windows. This page describes ways to have your PmWiki installation appear as a URL other than that of the @@pmwiki.php@@ script itself. The examples below assume that a URL such as [=http://www.example.com/wiki=] is being set to refer to pmwiki.php on the www.example.com website.²²There are four basic ways to accomplish this: aliasing, making a "wiki" script, renaming the pmwiki script, or using mod_rewrite.²²!!! Aliasing²²First, if you have access to the web server configuration file, then simply adding the line²² Alias /wiki /path/to/pmwiki.php²²to the configuration file will perform the alias for you. In some cases (for instance Apache 2.0) you might be forced to use the full path to pmwiki.php, i.e.²² Alias /wiki /home/account/www/pmwiki.php²²even when you've already defined the documentroot as /home/account/www. You'll then need to set $PubDirUrl and $UploadsUrlFmt variables in config.php to point to the correct urls for your @@pub/@@ and @@uploads/@@ directories.²²Added by heck@fas.harvard.edu: Using Apache 2.0.x, I also needed to alias the pub directory. The link tags that load the style sheets will now point at e.g. [=http://example.com/wiki/pub/css/stdlayout.css=], but that is aliased to /home/account/www/pmwiki.php/pub/css/stdlayout.css, which makes no sense. The solution is to add another alias:²² Alias /wiki/pub /home/account/www/pub²²Note that you can put these directories anywhere: They do not have to be under your [=DocumentRoot=].²²NOTE (added be tj-AT-web62.com): Tis did not work for me, don´t know why. If I did it like above, the second Alias just triggered a request to the wiki error message²²'pub/skins/pmwiki/pmwiki.css' is not a valid PmWiki page name²²I had to add an ²²Alias /pub /home/account/www/pub²²to get it work right!²²''It seems that all steps described below only make sense, if in the configuration file of the webserver "[=AllowOverride=] None" '''not''' is set. All user specific directives are forbidden this way. So what then?? (fhattop@yahoo.de)''²²!!! Making a "wiki" script²If you don't have access to the configuration file, then a little bit of redirection is needed. First, create a file (not a directory) called "wiki" at the location where the webserver would normally access the "/wiki" URL. Often this is the web server's [=DocumentRoot=] directory, but it really depends on your site's configuration. Place the following PHP script in the @@wiki@@ file:²² <?php chdir("/path/to/pmwikidir"); include("pmwiki.php"); ?>²²In the script, replace @@/path/to/pmwikidir@@ with the name of the directory containing @@pmwiki.php@@. Then, add the following lines to the @@.htaccess@@ file in the same directory as the @@wiki@@ file (create the @@.htaccess@@ file if doesn't exist):² [=² <Files wiki>² SetHandler application/x-httpd-php² </Files>=]²²This tells the webserver to treat the @@wiki@@ file as a PHP script even though it doesn't end in @@.php@@. Now, requests for your @@wiki@@ file will cause the web server to change to the directory containing @@pmwiki.php@@ and execute it from there. Make sure $ScriptUrl in @@config.php@@ is pointing at the @@wiki@@ file, and not at the directory containing @@pmwiki.php@@.²²!!! Renaming the pmwiki.php file²²A third method is to just rename "pmwiki.php" to a more suitable name, for instance "do.php". If you're going to use the [[http://www.mrunix.net/webalizer/ webalizer]] web log analysis, you shouldn't rename "pmwiki.php" to "index.php". Webalizer 'strips' urls after the 'index.' part, thus effectively destroying all page referrals. For instance: access to '/index.php/Main/Abc' and '/index.php/Main/Xyz' are both referred to as '/', with two counts.²²If you want pmwiki to load automatically when you type in a URL that ends in a directory, you can do one of two things. If you can use the Alias directive in your web server configuration file, simply use the Alias directive described above. If you cannot do so, try adding the following to the @@.htaccess@@ file in the pmwiki directory:²² [=DirectoryIndex=] pmwiki.php²²This causes pmwiki.php to be loaded by default instead of index.php or index.html, and obscures the filename, at least for first-time visitors.²²!!! Using mod_rewrite²²The Apache Web server has all kinds of crazy features, one of which is [[http://httpd.apache.org/docs/mod/mod_rewrite.html mod_rewrite]]. The following recipe in an .htaccess file should get your urls looking real real nice:² [=² RewriteEngine on² RewriteBase /² RewriteRule ^([A-Z].*) /path/to/pmwiki/pmwiki.php?pagename=$1 [L,qsappend]=]²²When using mod_rewrite make sure you have all the following set in your local/config.php²² @@[= $ScriptUrl = 'http://yourdomain.com/dir/pmwiki.php';=]@@ \\² @@[= $PageUrlFmt = 'http://yourdomain.com/$Group/$Title_';=]@@ \\² @@[= $PubDirUrl = 'http://yourdomain.com/dir/pub';=]@@ \\² @@[= $UploadUrlFmt = 'http://yourdomain.com/dir/uploads';=]@@²²!!! Getting cleaner [=URLs=] out of PmWiki²²You have to change your local configuration to get PmWiki itself to generate pretty urls. Setting the $EnablePathInfo variable to 1 will tell PmWiki to make pretty page names with slashes ("/") instead of dots in them, and no "pagename=" stuff. Then, setting $ScriptUrl to the pseudo-path you set up, ''without'' a trailing slash, will make things look really nice. For instance, the above mod_rewrite commands combined with \\² @@[=$ScriptUrl = "http://wiki.example.com";=]@@ \\²in config.php would result a URL that looks like this \\² @@[=http://wiki.example.com/Main/HomePage/=]@@.²²²-----------------------²%trail%<<|PmWiki.DocumentationIndex|>>
- time=1082327323
- host=213.47.82.166
- agent=
- rev=51
- post= Save
- name=PmWiki.ChangePmWikiURL
- author=
|