0
votes

I have site working on var/www/html folder.

I have another site on var/www/html/mynewsite.

And when i try to access it like this server ip 1.2.3.4/mynewsite

Its not working getting 404 not found error.

Apache Configurations

DocumentRoot "/var/www/html/public/" Options FollowSymLinks MultiViews AllowOverride All #Order allow,deny Require all granted

1
What web server are you using (apache/nginx/other) ? Can we see the config ? Did you try restarting your webserver ?LolWalid
using apache. i have not tried restartinguser10075930
DocumentRoot "/var/www/html/public/" <Directory "/var/www/html/public"> Options FollowSymLinks MultiViews AllowOverride All #Order allow,deny Require all granted </Directory> config file for main site. @LolWaliduser10075930
DocumentRoot /var/www/html/public/ look like you have to put your mynewsite under /var/www/html/public/ and not /var/www/html/, don't forget to reload your apache configLolWalid
Could you edit your post and add your apache configuration so other users can easily see your problemsLolWalid

1 Answers

1
votes

According to apache official documentation, the easiest solution is to use serverName configuration field.

Listen 80
<VirtualHost *:80>
    DocumentRoot "/www/html/public"
    ServerName www.mainsite.com

</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/www/html/mynewsite"
    ServerName www.mynewsite.com

</VirtualHost>

For testing you can change your local hosts to make www.mynewsite.com and www.mainsite.com redirect to 1.2.3.4)

When going live you'll have to change your dns.

Hope that helps