Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache htaccess通配符子目录_Apache_.htaccess - Fatal编程技术网

Apache htaccess通配符子目录

Apache htaccess通配符子目录,apache,.htaccess,Apache,.htaccess,我需要设置一个htaccess文件到alias子目录,这些子目录不存在于公共位置。URL应该看起来好像目录确实存在。如果存在目录或文件,则应使用这些文件 RewriteEngine On #Allow any files or directories that exist to be displayed directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (

我需要设置一个htaccess文件到alias子目录,这些子目录不存在于公共位置。URL应该看起来好像目录确实存在。如果存在目录或文件,则应使用这些文件

RewriteEngine On

#Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


RewriteRule (.*)/(.*)/(.*) current/$2/$3 [QSA,L]
RewriteRule (.*)/(.*) current/$2 [QSA,L]

如何容纳第n个子目录?顶层1是唯一需要加别名的。斜杠对重写规则来说并不特殊。确保你没赶上第一个

RewriteRule ^/?([^/]*)/(.*)$ current/$2 [QSA,L]

如果别名目录上没有尾随斜杠,是否可以将其更改为current/index.php?我不会。只需为它添加另一条规则。