在Apache中重写不起作用。尝试了一切

时间:2013-11-13 21:36:31

标签: php apache .htaccess mod-rewrite url-rewriting

我尝试过,但我无法改写作品。

服务器版

juan@debian:/var/www/versioned/gestionClaro$ /usr/sbin/apache2 -v
Server version: Apache/2.2.22 (Debian)
Server built:   Mar  4 2013 22:05:16

默认启用

sudo a2enmod rewrite
Module rewrite already enabled

的.htaccess

Options -Indexes

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule (.*) template.php?page=$1 [L,QSA]

的/ etc / apache2的/位点可用/默认

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>
<Directory /var/www/versioned/gestionClaro>
    AllowOverride All
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride All
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

注意:来源位于/ var / www / versioned / gestionClaro

之下

在/ etc / apache2 / mods-enabled /

rewrite.load

rewrite.load内容

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

我当然重启了apache

sudo service apache2 restart

文件夹内容

juan@debian:/var/www/versioned/gestionClaro$ ls -al
total 60
drwxrwxrwx  8 juan juan 4096 Nov 13 18:16 .
drwxrwxrwx 26 juan juan 4096 Nov  5 18:48 ..
drwxr-xr-x  6 juan juan 4096 Nov 13 17:25 assets
-rw-------  1 juan juan   73 Nov 13 18:08 .directory
drwxr-xr-x  3 juan juan 4096 Nov 13 17:59 doc
drwxrwxrwx  8 juan juan 4096 Nov 13 18:03 .git
-rwxrwxrwx  1 juan juan  155 Nov 13 18:21 .htaccess
-rw-r--r--  1 juan juan    2 Nov 13 18:15 .htaccess~
-rwxrwxrwx  1 juan juan 2673 Nov 13 18:10 index.php
-rwxrwxrwx  1 juan juan  682 Oct 14 11:34 init.php
drwxr-xr-x  5 juan juan 4096 Nov 13 17:58 mvc
drwxrwxrwx  3 juan juan 4096 Oct 10 15:37 nbproject
drwxrwxrwx  9 juan juan 4096 Nov 13 18:01 php
-rwxrwxrwx  1 juan juan 1385 Oct  7 18:46 readme.md
-rw-r--r--  1 juan juan   94 Nov 13 18:09 template.php

在apache2.conf中

...
    AccessFileName .htaccess
...

0 个答案:

没有答案