D
D
Dimarik2013-08-01 09:51:44
linux
Dimarik, 2013-08-01 09:51:44

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

4 answer(s)
N
Nikolai Vasilchuk, 2013-08-01
@Dimarik

Lots of options on StackOverflow .
Here is the simplest one (.htaccess):

RewriteEngine On
RewriteRule ^$ /site [L]

A
Amet13, 2013-08-01
@Amet13

You need to correct all the values DocumentRoot​​from /var/wwwto /var/www/siteand do the same in the block Directory, the virtual host config is usually located either in /etc/apache2/apache2.confor /etc/apache2/sites-available/*or/etc/apache2/conf.d/*

T
t_q_l, 2013-08-01
@t_q_l

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 .

N
Nikolai Turnaviotov, 2013-08-01
@foxmuldercp

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 question

Ask a Question

731 491 924 answers to any question