2017-12-07 1 views
1

私は、すべてのフォルダとファイルをブロックする.htaccessファイルを作成しようとしていますが、フォルダpublic、ファイルindex.php、ファイルajax.php、img 、cssとjs。 URLに何を入力しても、www.domain.com/index.phpにリダイレクトする必要があります。ほぼすべてが動いていますが、ajax.phpファイルはまだブロックされているので、javascriptファイルはアクセスできません。助言がありますか?.htaccessいくつかのファイルを除外したすべてのPHPファイルをブロックする

私のindex.phpはpublicフォルダに置かれ、他のすべてのphpファイルはphp、js、cssという名前のフォルダに置かれますが、それらは公開されていません。その/ root/publicと/ root/phpのようなものです。

RewriteEngine On 
RewriteBase/

RewriteCond %{REQUEST_URI} !^/(?:public/|(?:index|ajax)\.php$|.+\.(?:jpe?g|gif|png|ico|tiff|css|js)$) [NC] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.+)$ public/index.php?_url=$1 [QSA,L] 
:.htaccessファイルを
RewriteEngine On 

RewriteBase  /
RewriteCond  %{REQUEST_FILENAME} !-f 
RewriteRule  ^(.*)$ public/index.php?_url=$1 [QSA,L] 

RewriteCond %{REQUEST_URI} !^/(?:public/|index\.php$|ajax\.php$|.+\.(?:jpe?g|gif|png|ico|tiff|css|js)$) [NC] 
RewriteRule . - [F] 

答えて

1

はこのようにそれを持っている/に/ルートに置かれています
関連する問題