Php .htaccess在向站点添加新页面时重定向到索引页面

Php .htaccess在向站点添加新页面时重定向到索引页面,php,apache,.htaccess,Php,Apache,.htaccess,第一:我有一个.htaccess文件,现在我想添加一个新文件/admin/index.php将这一行添加到.htaccess:RewriteRule^admin/([0-9]+)/?$admin/index.php[L,QSA],但这会重定向到主页 第二:如果文件未找到404错误,我想重定向到notfound.html添加了这一行:ErrorDocument 404 contents/notfound.html 但是没有成功 保持.htaccess如下: DirectoryIndex index

第一:我有一个.htaccess文件,现在我想添加一个新文件/admin/index.php将这一行添加到.htaccess:
RewriteRule^admin/([0-9]+)/?$admin/index.php[L,QSA]
,但这会重定向到主页

第二:如果文件未找到404错误,我想重定向到notfound.html添加了这一行:
ErrorDocument 404 contents/notfound.html


但是没有成功

保持.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 *************************
DirectoryIndex.html index.php index.htm index.cgi
ErrorDocument 404 contents/notfound.html
重新启动发动机
重写基/
#index.php到主机
RewriteCond%{THE_REQUEST}^.*/index\.php
重写规则^(.*)index.php$/$1[R=301,L]
RewriteCond%{REQUEST_FILENAME}-f[或]
RewriteCond%{REQUEST_FILENAME}-d
重写规则^-[L]
#管理之家
重写规则^admin/([0-9]+)/?$admin/index.php[L,QSA]
#分页重写
重写规则^(.*)/([0-9]+)/([0-9]+)?$index.php?页面=$2&c_id=$3[L,QSA]
#业务评论重写
重写规则^([a-zA-Z0-9-!]+)/([a-zA-Z0-9-!]+)/([a-zA-Z0-9-!]+)/([a-zA-Z0-9-!]+)/?$contents/details.php?b!id=$4,status=$5[L,QSA]
#业务重写
重写规则^([a-zA-Z0-9-!]+)/([a-zA-Z0-9-!]+)/([a-zA-Z0-9-!]+)/([0-9]+)/?$contents/details.php?b_id=$4[L,QSA]
#索赔页重写
重写规则^claim/([0-9]+)/?$contents/claim.php?b_id=$1[L,QSA]
#报告页重写
重写规则^report/([0-9]+)/?$contents/report.php?b_id=$1[L,QSA]
#将主机重写为index.php
重写cond%{u请求}^(.*)$
重写规则^/?$index.php[L]
#主页重写
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}.php-F
重写规则^(.*)/?$contents/$1.php[L]
#类别重写
重新启动发动机
重写基/
RewriteCond%{REQUEST_FILENAME}-f[或]
RewriteCond%{REQUEST_FILENAME}-d
重写规则^-[L]
重写规则^([[u 0-9a-zA-Z-]+/)?$[L]
重写规则。index.php[L]
#**********************管理*************************

同样的结果。更奇怪的是,Macromedia Dreamweaver一次又一次地显示文件活动,甚至我在那里关闭了文件。以下是日志:Started:5/10/2014 8:39 PM.htaccess-Put操作成功文件活动完成。文件更新:1完成:5/10/2014 8:39 pm除非你提供我无法调查的具体信息。您在浏览器中看到的URL是什么?什么是错误?此.htaccess位于何处等?以下是您需要的信息。(1) 我正在尝试www.mydomain.com/admin/index.php,浏览器中会显示同样的内容。(2) 没有错误。(3) .htaccess位于根文件夹中。希望你现在可以调查。现在就试试<如果
/admin/index.php
是有效文件,则code>www.mydomain.com/admin/index.php应正常加载。相同结果:请查看www.star-business-directory.com/admin/index.php