2011-11-28 2 views
0

현재 동적 페이지가 있습니다. 예를 들어, index.php?p=proposal 내 웹 사이트 www/researchportal/.htaccess가있는 동적 페이지

현재의 루트에 /pages/landing.php에서 페이지를 열고 페이지 http://localhost/researchportal/proposal가 아닌 인덱스를 통해 자신의 (proposal.php, 아니 CSS의 단지 내용)에 의해로드 보인다 .php 파일. 즉, CSS가 제대로로드되지 않았 음을 의미합니다.

http://localhost/researchportal/index.php?p=proposal 

이 링크는로드 된 CSS로 올바르게로드됩니다.

http://localhost/researchportal/proposal 

이 링크에는 index.php 파일에 정의 된 헤더와 CSS가 포함되어 있지 않습니다. www/researchportal/

RewriteEngine On 
RewriteRule ^([A-Za-z0-9-_]+)$ index.php?p=$1 

왜 밤은 http://localhost/researchportal/proposal 로딩 제대로 내 웹 사이트의 루트에있는

내 htaccess로 파일?

답변

0

xxx.css에 대한 서버 요청이 index.php로 다시 라우팅되었다고 생각하면 정규식 패턴에 CSS 및 이미지 디렉토리의 예외를 추가해야합니다. robots.txt에 대한 예외 허용은 유용 할 것입니다.

0

현재 규칙은 모든 요청을 index.php로 보냅니다. 예를 들어 존재하는 실제 파일/디렉토리에 대한 요청을 방지하기위한 조건을 추가해야합니다. CSS가 index.php로 전송되지 않음

RewriteEngine On 
#Also recommend that you add a an explicit RewriteBase 
RewriteBase/

#only run this rule if the request is not for an existing file or directory 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([A-Za-z0-9-_]+)$ index.php?p=$1