Ubuntu Apache配置Rwrite URL重写

0.
apache
目录

1.
加载rewrite模块

  • 在/etc/apache2/
    目录下有两个模块文件夹,mods-available/mods-enabled。

  • 其中mods-available为可用模块存放文件夹,mods-enabled为激活模块存放文件夹。

  • Mods-enabled文件夹中存放的是mods-available文件夹中文件的软连接。

  • 因此,将mods-available文件夹中的文件,在mods-enabled文件夹中创建一个软连接即可。

命令:sudo
ln -s /etc/apache2/mods-available /etc/apache2/mods-enabled

2.
将主机中的<Directory></directory>中的AllowOverride
None
改为
AllowOverride
all.

  • 在Ubuntu系统中与window中的配置文件的存放位置不同

  • Ubunut下配置文件在apache2.conf中。

  • 其中加载模块,和其他相应的配置文件,被摘出,单独放置。(参见上如apache目录)

  • 是将<directory></directory>中所有的AllowOverride
    None改为AllowOverride
    all。

3.
在你的网站根目录下创建
.htaccess文件

  • <IfModule
    mod_rewrite.c>

  • Options
    +FollowSymlinks

  • RewriteEngine
    On

  • RewriteCond
    %{REQUEST_FILENAME} !-d

  • RewriteCond
    %{REQUEST_FILENAME} !-f

  • RewriteRule
    ^(.*)$ index.php/$1 [QSA,PT,L]

  • </IfModule>

4.
重启Apache服务

命令:sudo
/etc/init.d/apache2 restart

Ubuntu_16.04 配置 Apache Rwrite URL 重写的更多相关文章

  1. apache的URL重写

    apache的url重写 第一步:修改apache\conf目录下的的httpd.conf文件 1.加载apache的url重写模块 大概122行:LoadModule rewrite_module ...

  2. ThinkPHP5.X PHP5.6.27-nts + Apache 通过 URL 重写来隐藏入口文件 index.php

    我们先来看看官方手册给出关于「URL 重写」的参考: 可以通过 URL 重写隐藏应用的入口文件 index.php ,Apache 的配置参考: 1.http.conf 配置文件加载 mod_rewr ...

  3. Nginx配置虚拟机,url重写,防盗链

    配置目录: ·     虚拟主机 ·     PHP支持 ·     URL重写 ·     防止盗链 ·     持续更新… 一.虚拟主机 1.创建 文件格式:{域名}.conf 具体如下: $ s ...

  4. Ubuntu16.04配置apache+php+mysql

    命令行配置apache input sudo apt-get install apache2 done! 命令行配置mysql 参见: MySQL install and setting 命令行配置p ...

  5. 配置伪静态(URL重写)

    本篇借鉴了很多文章,这里做个记录. 有时我们的导航栏出现xx.aspx?id=x&name=xx 等等这样,会显得不好看,我们可以利用伪静态来美化我们的导航栏,伪静态的形式可以自己定义,本质还 ...

  6. Ubuntu14.04配置Apache支持多个站点

    怎样在一个Ubuntu的机器上(虚拟机)配置Apache支持多个网站呢? 比如你有一台独立的Ubuntu虚拟机,配有一个外网的IP(45.46.47.48),并且注册了两个域名AAA.com和BBB. ...

  7. ubuntu12.04 配置apache+modwsgi+django1.5

    1.首先下载modwsgi  链接如下: http://files.cnblogs.com/baoyiluo/mod_wsgi-3.4.zip 2.解压并安装mod_wsgi: ./configure ...

  8. centos7 Apache开启URL重写组件并配置.htaccess实现伪静态

    第一.修改httpd.conf文件 A - 在etc/httpd/conf/目录下的httpd.conf 文件,找到: LoadModule rewrite_module modules/mod_re ...

  9. Apache Drupal URL重写【转】

    文章来源:http://www.cnblogs.com/ghj1976/archive/2010/07/19/1780844.html 在 drupal 跟目录下有个 .htaccess 文件, 这个 ...

随机推荐

  1. Tempo 2.0

    Tempo 2.0 Tempo is an easy, intuitive JavaScript rendering engine that enables you to craft data tem ...

  2. Xcode证书破解 iphone真机部署

    Xcode证书破解 iphone真机部署 证书伪造: 先按照该教程的步骤添加证书.注意,原教程选择的是"系统"证书,这里我们用"登录"证书,切记. Xcode破 ...

  3. MFC DLL资源动态切换

    在MFC使用过程中,遇到DLL资源与主EXE资源冲突问题. 出现这样的Bug,一时无从下手. 报错位置在核心代码中dlgcore.cpp. [cpp] view plaincopy BOOL AFXA ...

  4. poj2583---Series Determination

    #include <stdio.h> #include <stdlib.h> int main() { int x,y,z,a,b,c; while(scanf("% ...

  5. aliyun 启用ECS iptables

    iptables -t nat -A POSTROUTING -s 0.0.0.0/24 -o eth0 -j MASQUERADEservice iptables saveecho 1 > / ...

  6. nodejs中使用递归案例

    var http = require('http'); //1.正常逻辑第一步正常请求,动作进行一次的方法: function seqRequest(i,limit){ var req = http. ...

  7. 汇编程序hello world

    我们用C,C++,Java,C#等这样一些高级语言时一般会用到一个集成开发环境,啥编译链接之类的操作都集成到一起了,IDE给你自动完成了.随便点几下按钮就编译好运行起来了. 那假如是写了几行汇编代码该 ...

  8. bootstrap 响应式布局 居中问题

    大家能够通过table来设置居中: display: table; width: auto; margin-left: auto; margin-right: auto;

  9. org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was found in the CDATA sectio

    偶尔有一次beyond compare比较部署文件时,发现有一个JSP文件结尾的地方有一大堆空白的二进制符号,当时没有管,就覆盖上去了. =================背景分割线========= ...

  10. bit-map牛刀小试:数组test[X]的值所有在区间[1, 8000]中, 现要输出test中反复的数。要求:1. 不能改变原数组; 2.时间复杂度为O(X);3.除test外空间不超过1KB

    先来看看这个题目:数组test[X]的值所有在区间[1, 8000]中. 现要输出test中反复的数.要求:1. 不能改变原数组; 2.时间复杂度为O(X);3.除test外空间不超过1KB. 好, ...