1

我已经尝试了一切,但我无法获得重写作品。

服务器版本

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/sites-available/default

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
...
4

0 回答 0