1

我在这里遇到了htaccess的情况。我对 htaccess 还很陌生。所以,我正在使用codeigniter。现在我想做一个重定向。

codeigniter 的原始网址是:

www.mysite.com/index.php/admin/getz

现在,我想让用户输入 www.mysite.com/agetz 来访问上面的 url。到目前为止还不错。它通过以下方式实现:

RewriteRule ^agetz$ /index.php/admin/getz [L]

现在,我想做的是,当人们输入真实的 url 即 www.mysite.com/index.php/admin/getz 时,我想将它们重定向到 404 页面(出于某些安全原因,从其他人那里保护 url),并且当他们键入 www.mysite.com/agetz 时,我想允许他们访问 getz 控制器。

问题是,目前如果我采取任何技巧来踢任何将 url www.mysite.com/index.php/admin/agetz 输入到 404 的人,它也会踢 mysite.com/getz。必须使用 .htaccess 来完成。

4

1 回答 1

1

用这个替换你现有的代码:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php/admin/getz/?[\s\?] [NC]
RewriteRule ^ - [R=404,L]

RewriteRule ^agetz/?$ /index.php/admin/getz [L,NC]
于 2012-06-04T12:15:15.150 回答