Rewrite for Wiki Clean URL

Topics: Developer Forum, User Forum
Nov 4, 2009 at 12:11 PM

Hello all,

 

I am trying to setup Clean URLs for our Wiki which is hosted on an internal Domain

 

https://www.domain.xx.com/Testwiki/index.php?title=Main_Page

 

and I simply want it to be rewritten to https://www.domain.xx.com/wiki/Main_Page

My file currently reads as follows

 

RewriteCond %{HTTP_HOST} ^https://www.domain.xx.com

 

RewriteRule ^/wiki/(.*) /Testwiki/index.php?title=$1 [I,L]

 

Any ideas to help a newbie to rewriting URLs?

Coordinator
Nov 4, 2009 at 3:59 PM

The HTTP_HOST does not include the scheme (http, https).  It's the hostname only.  Also you need to escape the . characters.  they are wildcards in regex.  I am guessing you don't want wildcards.  And to only match when https is used as the scheme, use the HTTPS server variable.

Try something like this:

RewriteCond %{HTTPS}            ^on$                               [I]
RewriteCond %{HTTP_HOST}        ^www\.domain\.xx\.com$             [I]
RewriteRule ^/wiki/(.*)$        /Testwiki/index.php?title=$1       [I,L]

Check the IIRF logfile if that doesn't work perfectly.