I am trying to create .htaccess , but we have some difficulties.
Here are examples of what I need, remembering that everything should be on the same URL.
1) Whenever a user accesses a website, add /home/ to the end of the URL.
Before: http://app.meusite.com/ After: http://app.meusite.com/home/
2) I want all urls to be removed .php .
Before: http://app.meusite.com/login.php After: http://app.meusite.com/login/
3) I want all urls to be as follows:
Before:
http://app.meusite.com/usuario-adicionar.php http://app.meusite.com/usuario-editar.php http://app.meusite.com/usuario-excluir.php
After:
http://app.meusite.com/usuario/adicionar/ http://app.meusite.com/usuario/editar/ http://app.meusite.com/usuario/excluir/
Just pay attention to the note ...
Since the entire site will be multilingual, everyone should accept a settings page that will receive LANG = LANGUAGE (Example: lang = en_US ).
Then, all of the above URLs should also accept GET vestments and would like to stay as follows:
http://app.meusite.com/index.php?lang=en_US http://app.meusite.com/home/en_US/ http://app.meusite.com/login.php?lang=en_US http://app.meusite.com/login/en_US/ http://app.meusite.com/usuario-adicionar.php?lang=en_US http://app.meusite.com/usuario/adicionar/en_US/ http://app.meusite.com/usuario-editar.php?lang=en_US http://app.meusite.com/usuario/editar/en_US/ http://app.meusite.com/usuario-excluir.php?lang=en_US http://app.meusite.com/usuario/excluir/en_US/
I hope he understands my question. And can you help me do this?
Below is my attempt:
Options -MultiViews Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^home\/?(.*)\/?$ index.php?lang=$1 [L] RewriteRule ^([^/]*)\/?(.*)\/?$ $1.php?lang=$2 [L] RewriteRule ^([^/]*)\/([^/]*)\/([^/]*)\/?$ $1-$2.php?lang=$3 [L]