0

我有一个脚本可以创建一个漂亮的文件夹目录列表。我称它为mydrive。我有两个素材,公共的和私人的,我在重新路由具有漂亮网址的人时遇到了问题。

放置在 /mydrive/public/folder1 中的文件被调用: /mydrive/files/mydrive.cgi?path=public/folder1

放置在 /mydrive/private/folder1 中的文件被调用: /mydrive/files/mydrive.cgi?path=private/folder1

我希望它像这样工作:

URL:www.domain.com/mydrive/folder1 调用:/mydrive/files/mydrive.cgi?path=public/folder1

URL:www.domain.com/mydrive/private/folder1 调用:/mydrive/files/mydrive.cgi?path=private/folder1

我已经尝试了几个食谱,但无法让它发挥作用。

4

1 回答 1

0
RewriteEngine On

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^/mydrive/(private/.*)$ /mydrive/files/mydrive.cgi?path=$1 [PT,L]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^/mydrive/(.*)$ /mydrive/files/mydrive.cgi?path=public/$1 [PT,L]

如果你把它放在你的虚拟服务器配置中,应该可以解决问题。

于 2013-03-06T19:57:55.440 回答