.htaccess - Using an alias in my Apache's httpd.conf to point to a cakephp 3.0 directory results in error 404 -


on centos lamp. have website, www.mydomain.com. in httpd.conf have:

<virtualhost *:80>     serveradmin me@myemail.com     documentroot /var/www/cakephp     servername www.mydomain.com     <directory /var/www/cakephp/>         options followsymlinks         allowoverride     </directory> </virtualhost> 

so www.mydomain.com served /var/www/cakephp.

but want url "www.mydomain.com/powercontroller/" served from: /var/www/powercontroller. put alias httpd.conf well:

alias /powercontroller/ "/var/www/powercontroller/" <directory "/var/www/powercontroller/">     allowoverride </directory> 

but doesn't work. url "www.mydomian.com/powercontroller" in browser gives me error 404 "the requested url /var/www/powercontroller/webroot/ not found on server."

my /var/www/powercontroller directory has following:

.htaccess

<ifmodule mod_rewrite.c>     rewriteengine on     rewriterule    ^$    webroot/    [l]     rewriterule    (.*) webroot/$1    [l] </ifmodule> 

index.php

require 'webroot' . directory_separator . 'index.php'; 

these default files cakephp 3.0 setup. , there webroot directory in place default cakephp 3.0.

i know must partway there because @ least it's looking in powercontroller directory. reason insists cannot find webroot.

ok figured out. when alias cakephp 3.0 app directory .htaccess in both app directory , webroot directory needs rewritebase directive. in case file /var/www/powercontroller/.htaccess , file /var/www/powercontroller/webroot/.htaccess both need line:

rewritebase /powercontroller/ 

right below line

rewriteengine on  

this information found nowhere. here's similar question never answered correctly, i'll answer. , here's analogous answer drupal clue found in week of searching.


Comments