I have to replicate the functionality of mod_alias that we can't use directly because I am on hosting that is shared, and Alias claims aren't effective inshtaccess.

What I wish to achieve is basically

Alias /manual /www/customer/some_other_dir/manual

I'm trying mod_rewrite:

RewriteRule ^/manual/(.*) /www/customer/some_other_dir/manual/%1?%{QUERY_STRING} [L]

this can never match any calls to www.example.com/manual.

Why don't you? What shall we be held doing wrong?


RewriteRule ^/manual(/(.*))?$ /www/customer/some_other_dir/$2 [L]

The ? means optional for that / character additionally towards the kleene closure around the . to make sure /manual, /manual/ and /manual/a/b/c although I gather a slash is generally added by apache pre-rewrite engine anyway.

A fast test on my small box shows this rule also passes the query string:

/manual/a/b?c=d -> /www/customer/some_other_dir/manual/$2

Tun off Multiviews option

Options -Multiviews

and i believe, it's expect / at finish of asked for URL.

Something similar to this can match www.example.com/manual too.

RewriteRule ^/manual/?(.*) /www/customer/some_other_dir/manual/%1?%{QUERY_STRING} [L]