简体   繁体   中英

Redirect my IP to another section of the site using HTACCESS

I'm trying to redirect all my traffic to a different part of the site and to redirect my IP to the development section, can someone tell me what I've done wrong?

RewriteCond %{REMOTE_ADDR} ==My IP
RewriteRule ^([^/\.]+)/?$ dev/index.php?page=$1 [L]

If i goto mysite.com/index it goes to a 404. If I remove the rewritecond for my IP then it works.

You can use that rule like this:

RewriteCond %{REMOTE_ADDR} =11.22.33.44
RewriteRule ^([^/.]+)/?$ dev/index.php?page=$1 [L,QSA]

RewriteCond %{REMOTE_ADDR} =11.22.33.44
RewriteRule ^([^/.]+)/([^/.]+)/?$ dev/index.php?page=$1&action=$2 [L,QSA]

try this:

RewriteRule ^([^/.]+)/?$ /dev/index.php?page=$1 [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM