Run cakephp app in apache alias

六眼飞鱼酱① 提交于 2019-12-12 18:24:13

问题


I'm trying to deploy a cakephp 3.1 app in a apache 2.4 powered server. My boss would like to place the app in a directory different of server's documentroot (DocumentRoot "/var/www/html" in my httpd.conf file), since multiple webapps will be served by this server.

Instead of virtualhosts, he would like to use aliases (host/app1, host/app2 etc). So I'm trying to configure it this way. I put an alias to my cake app (Alias "/scqa" "/opt/scqa/webroot" in my httpd.conf file) and wrote a RewriteBase (RewriteBase /scqa) to both cake's .htaccess files, but every absolute link present in my app is still pointing to apache's documentroot. In this particular case, it means my css and a big pile of not properly built links are 404ing. Is there some way I can fix it in apache configuration? I know 2 other ways to fix it: Fix the links with cake syntax (will take me a week) or use virtualhosts. But is it possible to fix it and keep using apache alias?

Thanks in advance.

(The production env uses centos 7 64bits, just in case)


回答1:


If I understood well, you are using aliases in your .htaccess files. You should put the Alias in your server config file, because it won't work otherwise.

Syntax: Alias [URL-path] file-path|directory-path

Context: server config, virtual host, directory

From https://httpd.apache.org/docs/current/mod/mod_alias.html



来源:https://stackoverflow.com/questions/35701544/run-cakephp-app-in-apache-alias

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!