我想要的結果無非是去掉URL路徑中的index.php
首先是配置.htaccess
RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
因為我部署在apache上面,需要httpd.conf設定檔中找到LoadModule rewrite_module modules/mod_rewrite.so去掉前面的#,找到AllowOverride None改為AllowOverride All。
現在訪問localhost/product有效,但是__APP__或者__URL__或者U擷取出來的路徑包含有index.php,也就是為localhost/index.php,原來還有一步,需要在conf/config.php裡面修改或者添加'URL_MODEL'=>2,
而因為我嘗試部署的是基於ThinkPHP的conist企業版2.0,在config.php裡竟然有這麼一個配置'URL_MODEL' =>C('TOKEN.false_static'),,而TOKEN.false_static的值在初始化的時候被設定為了1,所以。。。模式一直還是1,PATHINFO模式。
在新浪SAE部署,不支援.htaccess,只支援其自有的設定檔config.yaml,所以要在config.yaml添加下面這段重寫格式代碼:
handle:- rewrite: if(!is_dir() && !is_file() && path~"^(.*)$") goto "index.php/$1"
http://www.bkjia.com/PHPjc/825531.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/825531.htmlTechArticle我想要的結果無非是去掉URL路徑中的index.php 首先是配置.htaccess IfModule mod_rewrite.cRewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FI...