将页面重定向到使用ip .htaccess的其他页面

时间:2019-03-21 19:56:19

标签: wordpress .htaccess redirect url-redirection permalinks

我想将页面(帖子)(domain.com/general/test /)重定向到(domain.com/general/test/2) >与 .htacces

并使用 ip  说我只想为ip xx.xx.xx人进行重定向。

  • 我使用wordpress cms
  • 我使用永久链接domain.com/category/postname

** mycode但不起作用:( **

RewriteEngine On  
RewriteCond %{REMOTE_ADDR} ^xx\.xx\.xx\.xx$    
RewriteRule ^test\ /test/2 [R,NC,L]

2 个答案:

答案 0 :(得分:0)

尝试一下:

RewriteEngine On  
RewriteCond %{REMOTE_ADDR} ^xx\.xx\.xx\.xx$ 
RewriteCond %{REQUEST_URI} !/general/test/2   
RewriteRule ^general/test/ /general/test/2 [R,NC,L]

答案 1 :(得分:0)

@mohammed

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]