I have a MVC app in PHP and it's working well, but I want to have a feature where I can mask URLs, for example I have this URL localhost:1900/index/register
which calls from the index.php
controller the method register
.
However, I only want to show localhost:1900/register
as URL and still do the same thing, call from index.php
the register
method, any ideas on how can I obtain that? I am using Apache with htaccess.
This is the content of htaccess:
RewriteEngine On
php_flag display_errors on
php_value short_open_tag 1
php_value upload_max_filesize 1000M
php_value post_max_size 1000M
php_value max_input_time 300
php_value max_execution_time 300
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]