.htaccess - 根据用户IP加载特定内容

时间:2018-04-11 06:59:49

标签: .htaccess

在我的服务器上,我有两个目录,都有php / css / jpg / png文件。一个目录名为devel,第二个目录为release。两个目录包含相同的页面,但具有不同的版本。 release用于向客户公开稳定的内容,devel是我的工作目录。目前,这两个页面都可通过以下地址获得:http://example.com/devel/index.phphttp://example.com/release/index.php

是否有可能有一个.htaccess文件,当用户IP为http://example.com/index.phphttp://example.com/devel/index.php时,123.123.123.123等请求会加载http://example.com/release/index.php

这是我当前的.htaccess文件:

# Disable directory browsing
Options All -Indexes

# Enable rewrite engine
RewriteEngine on

# Force non-www
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/ [L,R=301]

# For not specified files extensions redirect to Entry.php
RewriteRule !^.*\.(css|js|jpg|png)$ Entry.php

# Force trailing slash
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]

0 个答案:

没有答案
相关问题