网址验证通过网址:掩码网址+ ajax + php + htaccess?

时间:2013-11-30 02:45:29

标签: php regex apache .htaccess mod-rewrite

这很难解释,更好的例子......

我有这个有效的网址:www.sitetoautenthicate.com/portal/index.php

要访问此页面,我想将网址屏蔽到www.sitetoautenthicate.com/portal/myportal/index.php,其中 myportal 必须通过外部API(ajax帖子)进行身份验证(存在于数据库中)

我还想禁止访问www.sitetoautenthicate.comwww.sitetoautenthicate.com/portal/

我认为这只能通过.htaccess

来完成

1 个答案:

答案 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]