|
添加了一个.htaccess 文件,内容是这样:
TEXT
RewriteEngine On
RewriteBase /p2v/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /p2v/index.php?/$1 [L]
复制代码
修改了 system/core/URI.php 文件的 _set_uri_string 函数和 _explode_segments 函数
PHP
/**
* Set the URI String
*
* @access public
* @param string
* @return string
*/
function _set_uri_string($str) {
if ($this->config->item("base_folder")) {
if ($str == $this->config->item("base_folder")) {
$str = "";
}
}
// Filter out control characters
$str = remove_invisible_characters($str, FALSE);
// If the URI contains only a slash we'll kill it
$this->uri_string = ($str == '/') ? '' : $str;
}
/**
* Explode the URI Segments. The individual segments will
* be stored in the $this->segments array.
*
* @access private
* @return void
*/
function _explode_segments() {
$is_ignored = FALSE;
foreach (explode("/", preg_replace("|/*(.+?)/*$|", "\1", $this->uri_string)) as $val) {
// Filter segments for security
$val = trim($this->_filter_uri($val));
if ($val != '') {
if (!$is_ignored && $this->config->item("base_folder")) {
if ($val == $this->config->item("base_folder")) {
$is_ignored = TRUE;
continue;
}
}
$this->segments[] = $val;
}
}
}
复制代码
在 application/config/config.php 里面增加了配置:
PHP
$config['base_folder'] = 'p2v'; 这个要新增加的
$config['base_url'] = 'http://www.58xxw.com/p2v/'; 这个配置文件中有的 只用修改成二级的就可以了
复制代码
|
|