.htaccess 在url中隐藏文件夹,重写url

.htaccess 在url中隐藏文件夹,重写url,.htaccess,mod-rewrite,url-rewriting,typo3,.htaccess,Mod Rewrite,Url Rewriting,Typo3,我有一个具有特殊托管结构的项目: 万维网 领域 projectName(example.com) 我必须设置baseUrlconfig.baseUrl=http://example.com/domains/example.com/。 Url示例http://example.com/domains/example.com/index.php?id=4 如果我只使用config.baseURL=http://example.com/。站点工作,但会话不工作,用户无法登录(他可以登录,但在

我有一个具有特殊托管结构的项目:

  • 万维网
    • 领域
      • projectName(example.com)
我必须设置baseUrl
config.baseUrl=http://example.com/domains/example.com/
。 Url示例
http://example.com/domains/example.com/index.php?id=4

如果我只使用
config.baseURL=http://example.com/
。站点工作,但会话不工作,用户无法登录(他可以登录,但在重新加载后注销)

我只需要有带有
http://example.com/index.php?id=x

www文件夹中有1个htaccess具有这些规则

RewriteEngine On

RewriteCond %{REQUEST_URI} !^domains/
RewriteCond %{REQUEST_URI} !^/domains/
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$
RewriteCond %{DOCUMENT_ROOT}/domains/%2 -d
RewriteRule (.*) domains/%2/$1 [DPI]

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,QSA,L]

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^domains/[^/]+/(.+[^/])$ /$1/ [R]
另一个在我的项目文件夹中

我相信只有一个简单的访问规则。但我没有这方面的经验。我试图使用来自的解决方案,但没有帮助。我尝试在两个htaccess文件中使用它

有什么想法吗


谢谢大家!

您可以尝试将打字脚本选项
config.absRefPrefix
设置为
/domain/www.example.com/


请参见和

太好了,它有助于会话保存。