I have a root folder /var/www/minus_project and only two files in it: index.php and .htaccess.
How to make apache2 redirect all requests like localhost.com/minus_project/some/url/here/... to index.php? My apache2 configuration
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html
Alias /phpinfo /var/www/phpinfo
Alias /minus_project /var/www/minus_project
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Here is how you create an alias and route everything to index.php
inside aliased directory.
Alias /minus_project /var/www/minus_project
<Directory /var/www/minus_project>
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
RewriteEngine On
RewriteBase /minus_project/
RewriteRule ^/index\.php$ - [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</Directory>
Place above snippet inside VirtualHost
section and don't forget to restart Apache server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With