我有这样的文件夹结构:
-- /var/www/domain
|
|-- wordpress
|-- framework
当您访问domain.com时,所需的功能是"文档根目录"在wordpress文件夹中。
当您打开domain.com/embed"文档root"将在框架文件夹中。
我最大的问题是,我仍然需要在这两个文件夹中支持规范的URL。wordpress的一些示例网址是:
domain.com/contact
domain.com/solutions/finance
domain.com/blog/something-happened-yesterday (this might be subdomain blog.domain.com - not decided yet)
嵌入将始终采用格式:
domain.com/embed/Category/Item?some=1,params=0
Wordpress和框架代码100%相互独立。
我想如果我只是将框架文件夹移动到wordpress文件夹并将其命名为" embed"它可能会省去很多麻烦并且工作得很好。但我觉得它不是很好的解决方案,并且更愿意像现在这样将它们分开。
更多片段:
我尝试了很多apache配置,这是其中之一:
<VirtualHost *:80>
ServerName u.ipushpull.com
ServerAdmin admin@ipushpull.com
DocumentRoot /var/www/ipushpull.com/u/wordpress
DirectoryIndex index.php index.html
Alias /embed/ /var/www/ipushpull.com/u/framework/code/wwwroot/
CustomLog ${APACHE_LOG_DIR}/ipushpull_web_u_access.log combined
ErrorLog ${APACHE_LOG_DIR}/ipushpull_web_u_error.log
LogLevel warn
</VirtualHost>
框架文件夹中的.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
谢谢
答案 0 :(得分:0)
好的,我找到了解决方案。
在查看日志后,我发现错误正在查找不应该存在的文件。经过更长时间的谷歌搜索后,我发现了一些有用的东西。
在你的htaccess中你必须将RewriteBase设置为Alias的第一个参数。
我的最终设定:
Apache虚拟主机
<VirtualHost *:80>
ServerName u.ipushpull.com
ServerAdmin admin@ipushpull.com
Alias /embed /var/www/ipushpull.com/u/framework/code/wwwroot
<Directory "/var/www/ipushpull.com/u/framework/code/wwwroot">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
DocumentRoot /var/www/ipushpull.com/u/wordpress
DirectoryIndex index.php index.html
CustomLog ${APACHE_LOG_DIR}/ipushpull_web_u_access.log combined
ErrorLog ${APACHE_LOG_DIR}/ipushpull_web_u_error.log
LogLevel warn
</VirtualHost>
.htaccess(在framework / code / wwwroot中)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /embed
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
像魅力一样工作