php rewrite

阅读更多
环境ubuntu14
apache2
php5

apt-get install php5
apt-get install libapache2-mod-php5

配置rewrite
ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

vim /etc/apache2/apache2.conf
最后一行
ServerName ubuntu

中间

        #Options FollowSymLinks
        Options Indexes FollowSymLinks
        Require all denied
        AllowOverride All 
        Order allow,deny
        Allow from all



        AllowOverride None
        Require all granted



        Options Indexes FollowSymLinks
        AllowOverride All 
        Require all granted
        Order allow,deny
        Allow from all




主要是
        AllowOverride All
        Order allow,deny
        Allow from all

/etc/apache2/sites-enabled/000-default.conf
设置根路径
DocumentRoot /var/www



/var/www下
建立
.htaccess

RewriteEngine On
#RewriteRule "index.html" "index.php" [P,L]
RewriteRule "index.html" "index.php"



apachectl restart
http://ubuntu/index.html
会跳转到index.php

你可能感兴趣的:(php,rewrite)