[pmwiki-users] Clean URLs .htaccess mod_rewrite problem
marc
gmane at auxbuss.com
Mon Dec 4 07:27:01 CST 2006
marc said...
> Hi,
>
> Installation is a default Pmwiki, latest version.
>
> I'm trying, but failing, to route these (with no trailing slashes)
>
> http://www.auxbuss.com/pmwiki -> http://www.auxbuss.com/pmwiki/
> http://auxbuss.com/pmwiki -> http://www.auxbuss.com/pmwiki/
>
> The same URLS with trailing slashes work fine. Namely,
>
> http://www.auxbuss.com/pmwiki/ -> http://www.auxbuss.com/pmwiki/
> http://auxbuss.com/pmwiki/ -> http://www.auxbuss.com/pmwiki/
>
> www/pmwiki/.htaccess is:
>
> RewriteEngine on
>
> # if no trailing slash
> RewriteCond $1 !/$
> # but is a directory when we add a trailing slash
> RewriteCond %{REQUEST_FILENAME}/ -d
> # then add slash and redirect
> RewriteRule (.+) http://www.auxbuss.com/$1/ [R=301,L]
>
> RewriteCond %{HTTP_HOST} ^auxbuss.com$ [NC]
> RewriteRule ^(.*)$ http://www.auxbuss.com/pmwiki/$1 [R=301]
> RewriteBase /pmwiki
> # Send requests without parameters to pmwiki.php.
> RewriteRule ^$ index.php [L]
> # Send requests for index.php to pmwiki.php.
> RewriteRule ^index\.php$ pmwiki.php [L]
> # Send requests to pmwiki.php, appending the query string part.
> RewriteRule ^([^/a-z].*) index.php?n=$1 [QSA,L]
>
>
> Without the first condition/rule set ({REQUEST_FILENAME}, etc.)
> http://www.auxbuss.com/pmwiki -> http://www.auxbuss.com/pmwiki/
> works okay, because it the first condition/rule set that isn't correct.
>
> The erroneous result is:
>
> http://www.auxbuss.com//home/domains/auxbuss.com/web/pmwiki/
>
> In other words the mod_rewrite %{REQUEST_FILENAME} variable is being
> used for the $1 in the rewrite rule instead of 'pmwiki', as I want.
>
> Can someone please advise on the correct way to do this. Thanks.
For everyone who has been thrilled to follow this tale, I thought you
might like to know that I found the solution.
RewriteCond $1 !/$
RewriteCond %{REQUEST_FILENAME}/ -d
RewriteRule (.+) $1/ [N]
This is okay for each field too, in a regular farm setup.
Should this go in the docs?
--
Best,
Marc
More information about the pmwiki-users
mailing list