重定向到具有 .htaccess 的子文件夹



我有以下系统文件夹:

.htaccess
- www
  - index.html
  - assets
  - dev
  - prod

当您访问域的 url (www.example.com) 时,您会看到index.html

好吧,我只想重定向到除我的 ip 之外的每个 ip prod子文件夹。我试过这个:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^ myIP
RewriteRule http://www.example.com/prod/ [L]

谢谢。

试试这个

RewriteEngine on
RewriteRule ^prod/(.*)$ /$1 [R=301,L]

请参考这个:http://beginnersbook.com/2013/08/redirect-subdirectory-to-root-using-htaccess/

最新更新