Scenario:
I have a http://www.example.com/ and I want my new project to be accessed via http://www.example.com/new.
Here's what I tried:
DocumentRoot /var/www/html/old/public/
Alias /new "/var/www/html/old/new/public/" # -> I tried
The problem with this is it's only working on http://www.example.com/new but if I access another page like http://www.example.com/new/page1 it's looking for the routing in the old project.
.htaccess on document root
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Here's the Nginx version, unfortunately the server I'm working with is Apache so I need to convert this into Apache vhost
location ^~ /new {
alias "/var/www/html/old/new/public/";
if (!-e $request_filename) {
rewrite ^/(.*) /new/index.php?$query_string last;
}
try_files $uri $uri/ /index.php?$query_string;
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)?$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}