当前位置: 代码迷 >> Access >> php mvc 透过 htaccess 隐藏 index.php 或 index.php?arg=
  详细解决方案

php mvc 透过 htaccess 隐藏 index.php 或 index.php?arg=

热度:3974   发布时间:2013-02-26 00:00:00.0
php mvc 通过 htaccess 隐藏 index.php 或 index.php?arg=

?

自己写了一个mvc 但是有的hosting无法通过 htaccess 正常隐藏 index.php 或 index.php?arg=, 下面找到了答案:


# Turn on URL rewritingRewriteEngine On# Installation directory 如果你的项目在非根目录的话,就填目录名,比如:/test/RewriteBase /DIR_HERE/# Protect application and system files from being viewedRewriteRule ^(application|modules|system) - [F,L]# Allow any files or directories that exist to be displayed directlyRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d# Rewrite all other URLs to index.php/URLRewriteRule .* index.php/$0 [PT,L]# or#RewriteRule .* index.php?arg=$0 [PT,L]
?
以上代码写到 .htaccess 文件,并放置项目根目录下

?

?

  相关解决方案