需要将所有php文件重写到我的index.html(已经完成)但是如果有人写http://192.168.X.X/moodle重写到另一个moodle页面也需要。 (仅限IP)
我试过了:
RewriteEngine On
RewriteBase /
RewriteRule ^.*\.php$ index.html
# This one is bad because I only want to work with de IP...
# RewriteRule ^moodle$ http://moodle.mywebsite.net
# This code doesn't works...
RewriteCond %{HTTP_HOST} !^192.168.30.143 [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://moodle.mywebsite.net/$1 [L,R]
答案 0 :(得分:0)
您可以使用此规则检测192.168.
IP并重定向它们:
RewriteCond %{HTTP_HOST} ^192\.168\.
RewriteRule ^moodle(/.*)?$ http://moodle.mywebsite.net$1 [L,R=301]