octobercms.htaccess 结构

octobercms .htaccess structure

我需要有关 october cms .htaccess 文件的帮助。在我的根目录中,除了我的网站文件夹和文件外,我还有一个文件夹,其中包含一些项目的网站,其中有 4 个。

在我实际的 octobercms 网站中,我希望每个网站都有 4 个链接。

projects/project-A projects/project-B projects/project-C projects/project-D

我必须在我的 .htaccess 文件中做什么才能打开每个网站?

谢谢!

也许这对你有帮助

Redirect /projects/project-A/ http://www.example.com/private/

我假设 projects 文件夹位于您 OctoberCMS 所在的 root 文件夹中,简而言之,index.php.htaccess 文件所在的文件夹。

然后你需要告诉apache当它在URL

开头看到projects时不要将所有请求重写到index.php文件

.htaccess 文件添加规则

##
## White listed folders
##
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !/.well-known/*
RewriteCond %{REQUEST_FILENAME} !/storage/app/uploads/.*
RewriteCond %{REQUEST_FILENAME} !/storage/app/media/.*
RewriteCond %{REQUEST_FILENAME} !/storage/temp/public/.*
RewriteCond %{REQUEST_FILENAME} !/themes/.*/(assets|resources)/.*
RewriteCond %{REQUEST_FILENAME} !/plugins/.*/(assets|resources)/.*
RewriteCond %{REQUEST_FILENAME} !/modules/.*/(assets|resources)/.*

....

Just add one more entry here like

RewriteCond %{REQUEST_FILENAME} !/projects/*

它现在允许您从 projects 服务器文件,您可以从这些文件夹浏览网站。

link 会像 https://october-plaza.com/projects/index.html

我不太了解 .htaccess 但我将这样的文件夹列入白名单以便我可以从中访问文件

如有疑问请评论。