Home > Backend Development > PHP Tutorial > ThinkPHP兑现URL rewrite

ThinkPHP兑现URL rewrite

WBOY
Release: 2016-06-13 12:59:38
Original
804 people have browsed it

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模块就可以正常访问了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template