[HCoop-Help] pmwiki pretty urls [newbie]

seanmcl at hcoop.net seanmcl at hcoop.net
Mon Jun 14 09:12:59 EDT 2010


Hi,

  I'm trying to understand url rewriting with DomTool.  My wiki, based on
PmWiki, can use ModRewrite with .htaccess files to turn ugly urls like

http://www.example.com/~someuser/pmwiki/pmwiki.php?n=Main.HomePage

into pretty ones:

http://www.example.com/~someuser/Main/HomePage

The instructions I was using at my old host are these (taken from
http://www.pmwiki.org/wiki/Cookbook/CleanUrls):

Example Two: .htaccess in the Directory Above the Wiki's Directory

Before: http://www.example.com/~someuser/pmwiki/pmwiki.php?n=Main.HomePage
 After: http://www.example.com/~someuser/Main/HomePage

Here's the .htaccess file. In this example it goes in the directory above
the one that contains pmwiki.php.

# Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.
RewriteEngine On
# Define the rewrite base.  It's not necessarily PmWiki's directory.
RewriteBase /~someuser
# Send requests without parameters to pmwiki.php.
RewriteRule ^$           pmwiki/pmwiki.php  [L]
# Send requests for index.php to pmwiki.php.
RewriteRule ^index\.php$ pmwiki/pmwiki.php  [L]
# Send requests to pmwiki.php, appending the query string part.
RewriteRule ^([A-Z0-9\xa0-\xff].*)$ pmwiki/pmwiki.php?n=$1  [QSA,L]


I know .htaccess is not allowed at Hcoop, but the documentation says you
can do most things with DomTool.  I therefore looked at the reference, and
was happy to find the functions rewriteBase and rewriteRule.  However, I
can't get them to work.  When I try

rewriteBase "/", I get an error

seanmcl.com:10.5-10.25:error: Function argument has wrong type.
 Expression: rewriteBase
Actual type: no_spaces -> [Location]
Needed type: location

The rewriteRules compile, but the rewriting doesn't work as expected.

  web "cmu" where
    DocumentRoot = home "public_html/cmu";
  with
    rewriteRule "^$" "wiki/pmwiki.php" [redirectWith permanent];
    rewriteRule "^index\.php$" "wiki/pmwiki.php" [redirectWith permanent];
    rewriteRule "^([A-Z0-9\xa0-\xff].* )$" "wiki/pmwiki.php?n=$1"
[redirectWith permanent];
  end;

Does anyone have any ideas for me?

Thanks!

Sean





More information about the HCoop-Help mailing list