【问题标题】:Rewrite Rules Conflict with admin file?重写规则与管理文件冲突?
【发布时间】:2015-01-18 21:34:44
【问题描述】:

抱歉我的英语不好下面是我的 htaccess 完整文件我对重写规则了解不多但是如果我在 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

【问题讨论】:

  • 您好先生,再次感谢您尝试帮助我,我的网站的主管结构是 css、js、business、lib、include,文件是 index.php、admin.php 400.php、500 .php

标签: php .htaccess


【解决方案1】:

#Redirect static pages based on page name行上方插入此规则:

# skip all files and directories from rewrite rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

【讨论】:

  • 它可以工作,但现在没有显示 index.php 文件的内容?
  • 非常感谢 Anubhava 先生,我已经解决了剩余的问题?到目前为止,您是我见过的一位经验丰富的人。再次感谢您
猜你喜欢
  • 1970-01-01
  • 2015-03-23
  • 1970-01-01
  • 2012-06-09
  • 2021-08-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多