2014-05-10 5 views
0

첫 번째 : http://pastebin.com/L7FVXjDU .htaccess 파일이 있습니다. 이제이 파일을 /httaccess/ RewriteRule ^admin/([0-9]+)/?$ admin/index.php [L,QSA]에 추가 한 새로운 파일 /admin/index.php를 추가하려고합니다.하지만이 리디렉션 홈페이지로..htaccess가 사이트에 새 페이지를 추가 할 때 색인 페이지로 리디렉션됩니다.

2 : ErrorDocument 404 contents/notfound.html

하지만 성공 : 404 오류를 찾을 수없는 파일의 경우, 내가 원하는이 라인을 추가 notfound.html로 리디렉션!

답변

0

이처럼 htaccess로 유지 :

DirectoryIndex index.html index.php index.htm index.cgi  
ErrorDocument 404 contents/notfound.html 

RewriteEngine on 
RewriteBase/

#index.php to host 
RewriteCond %{THE_REQUEST} ^.*/index\.php 
RewriteRule ^(.*)index.php$ /$1 [R=301,L] 

RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 

#admin home 
RewriteRule ^admin/([0-9]+)/?$ admin/index.php [L,QSA] 

#pagination rewriting 
RewriteRule ^(.*?)/([0-9]+)/([0-9]+)?$ index.php?page=$2&c_id=$3 [L,QSA] 

#business review rewriting 
RewriteRule ^([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([0-9]+)/([a-zA-Z0-9-_]+)/?$ contents/details.php?b_id=$4&status=$5 [L,QSA] 

#business rewriting 
RewriteRule ^([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([0-9]+)/?$ contents/details.php?b_id=$4 [L,QSA] 

#claim page rewriting 
RewriteRule ^claim/([0-9]+)/?$ contents/claim.php?b_id=$1 [L,QSA] 

#report page rewriting 
RewriteRule ^report/([0-9]+)/?$ contents/report.php?b_id=$1 [L,QSA] 

#rewrite host to index.php 
RewriteCond %{THE_REQUEST} ^(.*?)$ 
RewriteRule ^/?$ index.php [L] 

#main pages rewriting 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME}.php !-f  
RewriteRule ^(.*?)/?$ contents/$1.php [L] 

#category rewriting 
<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} -f [OR] 
    RewriteCond %{REQUEST_FILENAME} -d 
    RewriteRule^- [L] 
    RewriteRule ^([_0-9a-zA-Z-]+/)?$ [L] 
    RewriteRule . index.php [L] 
</IfModule> 

# ******************* admin ************************* 
+0

같은 결과를. 1 이상한 점은 Macromedia Dreamweaver에서 파일 작업을 반복해서 보여 주므로 파일을 닫은 경우에도 마찬가지입니다. 다음은 로그입니다. 시작 : 5/10/2014 8:39 PM .htaccess - 작업 성공 파일 작업이 완료되었습니다. 업데이트 된 파일 : 1 완료 : 5/10/2014 8:39 PM – Muhammad

+0

구체적인 정보를 제공하지 않으면 조사 할 수 없습니다. 브라우저에서 볼 수있는 URL은 무엇입니까? 무엇이 잘못 되었습니까? 이 .htaccess는 어디에 있습니까? – anubhava

+0

여기에 필요한 정보가 있습니다. (1) www.mydomain.com/admin/index.php를 시도하고 있으며 브라우저에 동일한 내용이 표시됩니다. (2) 오류가 없습니다. (3) .htaccess는 루트 폴더에 있습니다. 이제 당신이 조사 할 수 있기를 바랍니다. – Muhammad

관련 문제