laravel 去掉index.php伪静态
1,首先,让apache服务器支持rewrite
可以在apache配置文件中定义rewrite规则,是全局的,无论哪个应用都实用
//httpd.config
Listen 80
RewriteEngine on ---将rewrite开启
LoadModule rewrite_module modules/mod_rewrite.so 前面的注释去掉
在Directory中配置:
<Directory "/www/poem/public">
Options Indexes FollowSymLinks
AllowOverride All ----这项一定要进行修改
Order deny,allow
Allow from all
</Directory>
2,配置.htaccess文件 ---find / -name .htaccess 来查找此文件
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] ---这句话的含义是:任何访问网站的路径都映射成index.php/xxx,其中xxx是$1 与 (.*)中的内容进行匹配 例如我们输入http://192.168.0.222/about -->http://192.168.0.222/index.php/about
</IfModule>
3,如果是专门针对laravel进行配置,则在app/app.php中加入
index=>'', //laravel4.1中没有此项,直接手写加入即可
如果还不行
先在httpd.conf注释掉
#<Directory />
# Options FollowSymLinks
# AllowOverride All
# Order deny,allow
# Deny from all
#</Directory>
然后在httpd-vhost修改如下,
<VirtualHost *:80>
ServerAdmin none@none.com
DocumentRoot "E:/www/learnlaravel5/public"
ServerName le
DirectoryIndex index.php index.html
ErrorLog "logs/dummy-host.2012-20090214YX.domain-error.log"
CustomLog "logs/dummy-host.2012-20090214YX.domain-access.log" common
<Directory "E:/www/learnlaravel5/public">
Options -Indexes +FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
#Require all granted
</Directory>
</VirtualHost>
laravel 去掉index.php伪静态的更多相关文章
- Apache RewriteCond RewriteRule 入门和Laravel去掉index.php
Ci删除index.php办法: 创建.htaccess 文件放到网站的根目录下,文件中的内容如下: RewriteEngine onRewriteCond %{REQUEST_FILENAM ...
- IIS 8.5 伪静态去掉index.php thinkphp 3.2.2
因为测试都是在win下开发的 win8.1企业版 II8.5 首先安装 Thinkphp 3.2.2 URL Rewrite Module 2.0 http://www.iis.net/downlo ...
- tp路由+伪静态+去掉index.php
浏览:10536 发布日期:2013/10/08 分类:技术分享 关键字: 路由 伪静态 去掉index.php 之前一个网友说能不能达到这样的效果,www.olcms.com/news/id.htm ...
- CodeIgniter学习笔记四:CI中的URL相关函数,路由,伪静态,去掉index.php
一.URL相关函数 1.加载url模块 加载url有两种方式: a.自动加载:在 application/config/autoload.php 中开启 $autoload['helper'] = a ...
- IIS7以上版本去掉伪静态去掉index.php方法
1,由于从iis7以上的版本httpd.ini文件已不会被解析,将以下的xml文件复制到web.config 的文件中,然后放到网站的根目录即可. <?xml version="1.0 ...
- nginx 静态化合集(去掉index.php目录)
访问某域名时,去掉index.php目录时达到效果一样 如:www.test1/index.php/test2跟www.test1/test2效果一致 在vhosts.conf中加重写就可以了 loc ...
- php CI 实战教程:如何去掉index.php目录
Windows下自由创建.htaccess文件的N种方法 .htaccess是apache的访问控制文件,apache中httpd.conf的选项配合此文件,完美实现了目录.站点的访问控制,当然最多的 ...
- lnmp 设置ci pathinfo和去掉index.php
LNMP上各个版本pathinfo各个版本的设置基本一样: lnmp v1.1上,修改对应虚拟主机的配置文件去掉#include pathinfo.conf前面的#,把try_files $uri = ...
- 更改CI框架默认访问路径及去掉index.php
下面是去掉index.php的操作 PHP CodeIgniter(CI)去掉 index.php - Langjun - 博客园 设置访问的默认路径是在
随机推荐
- mysql5.7脚本日常使用
#查看数据库物理存放目录show variables like "%datadir%";#查看所有数据库show databases#选择数据库use your_db_name#查 ...
- 在ubuntu中安装mysql及简单操作方式
老规矩,ctrl+alt+t呼出终端, 输入 sudo apt-get update 更新源,否则在运行下面代码时会报出有几个包无法下载,你还是得回来执行这句代码, 输入 sudo apt-get i ...
- 关于JAVA的基本知识
TCP/IP 协议族常用协议 应用层:TFTP,HTTP,SNMP,FTP,SMTP,DNS,Telnet 等等 传输层:TCP,UDP 网络层:IP,ICMP,OSPF,EIGRP,IGMP 数据链 ...
- 为什么CPU缓存会分为一级缓存L1、L2、L3?有什么意义?
https://baijiahao.baidu.com/s?id=1598811284058671259&wfr=spider&for=pc 简介:CPU缓存是CPU一个重要的组成部分 ...
- Neutron命令测试2
/etc/network/interfaces auto loiface lo inet loopback auto eth0iface eth0 inet manualup ifconfig $IF ...
- XStream xml转java对象2
<?xml version="1.0" encoding="UTF-8" ?> <person> <name>yunyun& ...
- php锁定文本框内容的方法
有时候我们希望表单中的文本框是只读的,让用户不能修改其中的信息,如<input type="text" name="zg" value="中国& ...
- php表单提交时的身份证号码验证
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...
- Windows窗体应用开发3--配置标准控件1
1.掌握主要的Windows窗体控件的功能 2.掌握使用SplitContainer控件的方法 3.掌握使用TreeView控件的方法 注:新建一个WindowsForm 命名为Form2.cs 主要 ...
- HttpClient4.3.3 禁止自动重定向
HttpClient4.3中默认允许自动重定向,导致程序中不能跟踪跳转情况,其实只需要在RequestConfig中setRedirectsEnabled(false)即可(默认是true): pri ...