linux中ubuntu 下apache开启rewrite模块方法

sudo a2enmod rewrite
在lamp下使用伪静态需要开启apache的rewrite模块,输入以上代码即可实现

不过经过测试还是不可以,这个时候可以修改一下apache文件

sudo emacs /etc/apache2/sites-available/default
修改几个参数:

<Directory />
Options FollowSymLinks
AllowOverride None(修改为AllowOverride All)
</Directory>
<Directory "/var/orioner">
Options Indexes FollowSymLinks MultiViews
AllowOverride None(修改为AllowOverride All)
Order allow,deny
allow from all
</Directory>
修改好后找个例子试试~

在网站根目录/var/www下建立一个.htaccess文件,内容如下

?RewriteEngine On RewriteRule ^(.*)$ /index.php

这个文件的意思是,不管输入什么网址,它都会被转到index.php下来,如果顺利通过即OK!

如果不行,把你要访问的文件设一下访问权限(包括.htaccess),设置方法

?sudo chmod 777 /* -R

 

时间: 2024-07-28 21:07:16

linux中ubuntu 下apache开启rewrite模块方法的相关文章

CentOs中Apache开启rewrite模块详解

centos的配置文件放在: /etc/httpd/conf/httpd.conf 打开文件找到:  代码如下 复制代码 LoadModule rewrite_module modules/mod_rewrite.so 将前面"#"去掉,如果不存在则添加上句. 如果你的网站是根目录的话:找到  代码如下 复制代码 <Directory />   Options FollowSymLinks   AllowOverride None  </Directory> 将

jira 6.X或confluence5.X linux/centos/ubuntu下设置开启启动

作者:风来了.带狐狸了 jira为例      (confluence 只要把 jira.sh 中的 _ROOT 和_NAME 路径和名称修改就可以) 保存代码 把以下代码另存为 jira.sh 上传至 jira目录 /www/jira centos #! /bin/sh # chkconfig: 2345 10 90 # description: jira .... # This script will be executed *after* all the other init script

linux中ubuntu下手动编译php-amqp扩展详细教程

PHP官网的amqp模块介绍在此,我也不多介绍.下面进入重点的安装环节. http://www.php.net/manual/en/book.amqp.php 用于ubuntu的默认源里面没有php5-amqp这个包,所以要用上amqp得考手动编译. 准备工作: # 安装php编译工具 sudo apt-get install php5-dev # 安装rabbitmq的库 sudo apt-get install librabbitmq-dev 然后如果你没有安装git话请安装一下git,因为

linux中Nginx+FastCGI+PHP 开启PHPINFO完美方法

 代码如下 复制代码 location ~ ^.+\.php {             root          D:/workspace;             fastcgi_pass   bakend;             fastcgi_index  index.php;             # 关键在这里             set $real_script_name $fastcgi_script_name;             if ($fastcgi_scr

Apache如何开启Rewrite模块?

ubuntu如何开启Rewrite模块 在终端输入: sudo a2enmod rewrite  开启Rewrite模块(停用模块,使用 a2dismod) sudo gedit /etc/apache2/sites-available/default 修改下面的地方 <Directory /> Options FollowSymLinks AllowOverride None(修改为AllowOverride All) </Directory> <Directory &qu

windows下apache的rewrite开启与规则使用说明

系统环境:Windows Apache 2.2 加载Rewrite模块: 在conf目录下httpd.conf中找到 LoadModule rewrite_module modules/mod_rewrite.so 这句,去掉前边的注释符号"#",或添加这句. 允许在任何目录中使用".htaccess"文件,将"AllowOverride"改成"All"(默认为"None"):  代码如下 复制代码 # A

ubuntu下apache服务器操作方法小结_Linux

Linux系统为Ubuntu 一.Start Apache 2 Server/启动apache服务 # /etc/init.d/apache2 start or $ sudo /etc/init.d/apache2 start 二. Restart Apache 2 Server/重启apache服务 # /etc/init.d/apache2 restart or $ sudo /etc/init.d/apache2 restart 三.Stop Apache 2 Server/停止apach

apache开启伪静态的方法分享_Linux

环境:系统 WindowsApache 2.2 加载Rewrite模块: 在conf目录下httpd.conf中找到 复制代码 代码如下: LoadModule rewrite_module modules/mod_rewrite.so 这句,去掉前边的注释符号"#",或添加这句. 允许在任何目录中使用".htaccess"文件,将"AllowOverride"改成"All"(默认为"None"): 复制代

Ubuntu下Telnet服务器的配置方法_Linux

1. 首先介绍linux中的守护进程 在Linux系统中有一个特殊的守护进程inetd(InterNET services Daemon),它用于Internet标准服务,通常在系统启动时启动.通过命令行可以给出inetd的配置文件,该配置文件列出了inetd所提供的服务清单.如果没有在命令行给出配置文件,那么inetd将从文件/etc/inetd.conf中读取它的配置信息.inetd的主要任务是为那些没有在系统初始化时启动的服务器进程监听请求,它在同配置文件中列出的服务相关联的TCP或UDP