한 가지 예외가 index.html을합니다 :아파치 2.4 htaccess로 - 포인트는 모든 요청은 내가 현재 <code>.htaccess</code> 다음 한
<IfModule mod_rewrite.c>
Options Indexes FollowSymLinks
RewriteEngine On
RewriteBase /production/
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
웹 서버의 문서 루트가 현재 위의합니다 (.htaccess
파일에서 참조 /production
폴더입니다 /production
이 삭제되고 모든 코드가 커밋됨에 따라 다시 작성되기 때문에 상위 폴더에 있음). 위 내용은 내 사이트로 유입되는 모든 트래픽을 index.html
으로 안내합니다.
예외를 만들고 싶습니다. 요청이 www.mydomain.com/specialrequest
이라면 부모 폴더에 script.php
이라는 PHP 스크립트를 실행하고 싶습니다. 검토
, 이것은 내 /var/www/html
디렉토리입니다 :
-html
-production
-anotherfolder
-.htaccess
-script.php
아파치가 /var/www/html/production
가리키는 내가 요청이 /specialrequest
경우를 제외하고 모든 요청은이 디렉토리에있는 index.html
파일에 가고 싶다 -이 경우, script.php
을 실행하고 싶습니다.
주의 할 사항 downvote? – MrWhite