1.关于URL路由的重写
开启Apache 的F:\warmpsever\wamp\bin\apache\Apache2.4.4\conf httpd.conf 中的mod_rewrite.so 模快
(将前面的#去掉) 将 AllowOverride None 将None改为 All(文件中的内容) 在THinkPHP 的配置中 URL_MODEL设置为2
重启Apache之后,原来的
http://serverName/index.php/Blog/read/id/1
就可以通过访问
http://serverName/Blog/read/id/1
简化了URL地址。
开启Apache 的F:\warmpsever\wamp\bin\apache\Apache2.4.4\conf httpd.conf 中的mod_rewrite.so 模快
(将前面的#去掉) 将 AllowOverride None 将None改为 All(文件中的内容) 在THinkPHP 的配置中 URL_MODEL设置为2
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
把下面的内容保存为.htaccess文件放到入口文件的同级目录下及 项目目录下
重启Apache之后,原来的
http://serverName/index.php/Blog/read/id/1
就可以通过访问
http://serverName/Blog/read/id/1
简化了URL地址。