apache - Apache2 - Rewrite rule not working (Remote address) -


does have idea, why rewrite rules in apache2 configuration not working?

    <virtualhost *:80> rewriteengine on rewritecond %{remote_addr} ^192\.168\.123\.121$ rewritecond %{remote_addr} ^192\.168\.1\.107$ rewritecond %{remote_addr} ^10\.17\. rewriterule ^(.*)$ /var/www/html/$1      documentroot "/var/www/html/phones"     servername 127.0.0.1 </virtualhost> 

what want is, if clients ip addresses 192.168.123.121, 192.168.1.107 or network 10.17.x.x come web server port 80, redirected different path (/var/www/html/) other ip addreses (/var/www/html/phones/)?

as far know multiple rewrite conditions 1 rewrite rule combined logical and. hence try "or next condition" (or) option:

rewritecond %{remote_addr} ^192\.168\.123\.121$ [or] rewritecond %{remote_addr} ^192\.168\.1\.107$ [or] rewritecond %{remote_addr} ^10\.17\. 

btw: maybe it's helpful activate logging, too. can use like

apache < 2.4

rewriteengine on rewritelog "/var/log/httpd/rewrite.log" rewriteloglevel 3 

apache >= 2.4 (see further information logging in apache 2.4)

loglevel alert rewrite:trace6 

in later case, should pipe log file through "fgrep" find interesting log entries. example:

tail -f /var/log/httpd/error_log | fgrep '[rewrite:'  

you should not use kind of logging in production environment.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -