抱歉我的英文不好下面是我的htaccess完整文件我不太了解重写规则我的所有链接在index.php周围工作正常但是如果我想执行我的admin.php文件它不允许我去但是如果我在htaccess文件中禁用了这一行(RewriteRule ^([^ /] +)/?$ index.php?Page = $ 1 [L,QSA]),它有效,我很困惑?
<IfModule mod_rewrite.c>
# Enable mod_rewrite
RewriteEngine On
# Specify the folder in which the application resides.
# Use / if the application is in the root.
RewriteBase /induspkm
# Rewrite to correct domain to avoid canonicalization problems
# RewriteCond %{HTTP_HOST} !^www\.example\.com
# RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
# Rewrite URLs ending in /index.php or /index.html to /
RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php|html?)\ HTTP
RewriteRule ^(.*)index\.(php|html?)$ $1 [R=301,L]
#Redirect static pages based on page name
RewriteRule ^([^/]+)/page-([0-9]+)/?$ index.php?Page=$1&PageNo=$2 [L,QSA]
RewriteRule ^([^/]+)/?$ index.php?Page=$1 [L,QSA]
# Rewrite images category pages
RewriteRule ^([^/]+)/.*([0-9]+)/page-([0-9]+)/?$ index.php?Page=$1&ImageCategoryId=$2&PageNo=$3 [L,QSA]
RewriteRule ^([^/]+)/.*([0-9]+)/?$ index.php?Page=$1&ImageCategoryId=$2 [L,QSA]
</IfModule>
# Set the default 500 page for Apache errors
ErrorDocument 500 /induspkm/500.php
#Set the defualt 404 error page
ErrorDocument 404 /induspkm/404.php
答案 0 :(得分:0)
将此规则插入 #Redirect静态页面的上方,基于页面名称行:
# skip all files and directories from rewrite rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]