PHP头条
热点:

ThinkPHP兑现URLrewrite


ThinkPHP实现URL rewrite
想用ThinkPHP实现URL rewrite,工程hello的目录结构如下:


http://localhost/hello/index.php/User/login,这个link是可以的。
http://localhost/hello/User/login,这个link就不可以。
http://localhost/hello/User/login

Apache httpd.conf文件的修改:
启用了LoadModule rewrite_module modules/mod_rewrite.so


    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all

修改AllowOverride为All

文件Conf/config.php的内容如下:
return array (
'URL_MODEL' => 2 
);

添加了.htaccess,内容如下:

   RewriteEngine on
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]


请问应如何使http://localhost/hello/User/login可以访问?多谢!
------解决方案--------------------

    Order allow,deny
    Deny from all


有吗?

------解决方案--------------------
在Apache下只需要开启mod_rewrite模块就可以正常访问了

www.phpzy.comtrue/phprm/33804.htmlTechArticleThinkPHP兑现URLrewrite ThinkPHP实现URL rewrite 想用ThinkPHP实现URLrewrite,工程hello的目录结构如下: http://localhost/hello/index.php/User/login,这个link是可以的。 http://localhost/hello/User/login,这个link就不...

相关文章

PHP之友评论

今天推荐