Access /index.php as / index (without the ".php")

0

Using regular expressions, I can check index.html pages as index but not index.php pages as index. My .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>

Within my apache, at /etc/apache2/sites-available address, I have the default virtual host and have the virtual host esms.com with the following content:

<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

Based on this information, I would like help in understanding what I am doing wrong.

    
asked by anonymous 03.01.2016 / 16:48

1 answer

1

Do not just change .html to .php:

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

Or you could try doing this that would fit any php file:

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

You can also try using mod_negotiation

    
03.01.2016 / 17:55