这很难解释,更好的例子......
我有这个有效的网址:www.sitetoautenthicate.com/portal/index.php
。
要访问此页面,我想将网址屏蔽到www.sitetoautenthicate.com/portal/myportal/index.php
,其中 myportal 必须通过外部API(ajax帖子)进行身份验证(存在于数据库中)
我还想禁止访问www.sitetoautenthicate.com
和www.sitetoautenthicate.com/portal/
我认为这只能通过.htaccess
答案 0 :(得分:1)
I also want to forbid access to www.sitetoautenthicate.com and www.sitetoautenthicate.com/portal/
在DOCUMENT_ROOT/.htaccess
文件中尝试此规则:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.sitetoautenthicate\.com$ [NC]
RewriteRule ^(portal)?/?$ - [F,NC]