我想用.htacces将页面(post)(domain.com/general/test/)重定向到(domain.com/general/test/2)
并使用ip,也就是说我只想对ip xx.xx.xx人进行重定向。
** mycode但没有工作:( **
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^xx\.xx\.xx\.xx$
RewriteRule ^test\ /test/2 [R,NC,L]
@穆罕默德
RewriteEngine On
RewriteCond %{HTTP_HOST} example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteEngine On
#RewriteCond %{REMOTE_ADDR} ^xx\.xx\.xx\.xx$
RewriteCond %{REQUEST_URI} !/test/2
RewriteRule ^test/ /test/2 [R,NC,L]
试试这个 :
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^xx\.xx\.xx\.xx$
RewriteCond %{REQUEST_URI} !/general/test/2
RewriteRule ^general/test/ /general/test/2 [R,NC,L]