Answer the question
In order to leave comments, you need to log in
How to redirect from xx.xx.xx.xx to xx.xx.xx.xx/site?
There is a server, Debian, Apache2, php…
It has a small website accessible by ip.
We decided to move the site deeper - it was /var/www, it became /var/www/site.
How to make Apache redirect everyone from xx.xx.xx.xx to xx.xx.xx.xx/site?
Or it should be done not by Apache but by iptables?
Answer the question
In order to leave comments, you need to log in
Lots of options on StackOverflow .
Here is the simplest one (.htaccess):
RewriteEngine On
RewriteRule ^$ /site [L]
You need to correct all the values DocumentRoot
from /var/www
to /var/www/site
and do the same in the block Directory
, the virtual host config is usually located either in /etc/apache2/apache2.conf
or /etc/apache2/sites-available/*
or/etc/apache2/conf.d/*
Strange that the crutch option given in the first answer is marked as "solution". Although true for this case is listed in Amet13 's answer .
Hey, wait - do you want to transfer the site from /var/www on disk to /var/www/mysite?
well, rewrite the virtualhost config indicating the new path to the directory with the site files, one, maximum two lines in the edit.
IPTables is a firewall that knows nothing about any sites and paths to sites.
it runs a couple of levels lower than apache and operates at the ip/hostname/port/net interface level
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question