繁体   English   中英

使用.htaccess重定向到子文件夹

[英]Redirect to a subfolder with .htaccess

我有以下系统文件夹:

.htaccess

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

当您访问域名的网址(www.example.com) ,您会看到index.html

好吧,我只是想重定向到每个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/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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