0

Utilizando expressões regulares, consigo verificar páginas index.html como index mas não paginas index.php como index. Meu .htaccess.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /login.php [L]
RewriteRule ^index$ index.html [NC,L]
</IfModule>

Dentro do meu apache, no endereço /etc/apache2/sites-available, tenho o virtual host padrão e tenho o virtual host esms.com com o seguinte conteúdo:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/var/www/html/meus_projetos/E-SMS-DEVEL"
    ServerName www.esms.com
    ServerAlias esms.com
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

AllowOverride All

    <Directory /var/www/html/meus_projetos/E-SMS-DEVEL>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Baseando nessas informações, gostaria de ajuda para entender o que estou fazendo de errado.

1
  • Bom dia, a resposta resolveu o seu problema?
    – Syzoth
    15/01/2016 às 13:39

1 Resposta 1

1

Não seria só trocar o .html por .php:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /login.php [L]
RewriteRule ^index$ index.php [NC,L]

Ou pode tentar fazer isto que serviria pra qualquer arquivo php:

RewriteRule ^([a-z0-9]+)$ $1.php [NC,L]

Você pode também tentar usar o mod_negotiation

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .