Mod Rewirte for CalDav and CardDav urls in Owncloud

孤街浪徒 提交于 2019-12-06 09:40:46

mod_rewrite Prepend Path to Requested URL with Dynamic Portion

Starting at server root, enter the requested URL path in the RewriteRule "pattern" parameter, and the desired path in the "substitution" parameter. In the form:

RewriteRule pattern substitution [flags]

In this case:

RewriteRule ^caldav/principals/edison/$ owncloud/remote.php/caldav/principals/edison/ [L]

If a portion of the URL (between slashes) varies and you don't want to (or can't) write a rule for every situation then use the regular expression ([^/]+) to capture the dynamic portion and inject it into your substituted path using the RE capture variable $1:

RewriteRule ^caldav/principals/([^/]+)/$ owncloud/remote.php/caldav/principals/$1/ [L]

The first set of parenthesis is $1, the second set is $2, etc. And capturing parenthesis can be nested.

Put the more specific rules higher in the rules list, and more general rules lower in the list. So I suggest putting this rule first, right after RewriteBase /.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!