Help in creating the .htaccess file

-1

Friends, good afternoon. I'm trying to create a nice .htaccess days, but we're having some difficulties.

Here are examples of what I need, remembering that everything needs to be on the same URL.

1) Whenever the user accesses the web site I want to add a "/ home /" at the end of the URL.

Antes: http://app.meusite.com/ 

Depois: http://app.meusite.com/home/

2) I want all URLs to be removed or ".php".

Antes: http://app.meusite.com/login.php

Depois: 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

Then:

http://app.meusite.com/usuario/adicionar/

http://app.meusite.com/usuario/editar/

http://app.meusite.com/usuario/excluir/

Only one comment to be taken into consideration ...

Because the whole site is multi-lingual, I need all pages to accept the get parameter which will be LANG = LANGUAGE (eg lang = en_US)

Then all of the above URLs should accept the GET parse too, and would like it to look like this:

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/

How do I do:

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]

I hope you can understand my question.

Right now, thank you very much.

Hugs!

    
asked by anonymous 28.07.2015 / 14:36

1 answer

0

You can only use this htaccess =

RewriteRule . /index.php [L] 

And treat all logic in this index.php, using the =

$url = explode("/", $_SERVER["REQUEST_URI"]);

Access a url and a print in the variable $ url that you will understand better, there inside the ifs that you will do within each url, you give an include in the page that will be opened.

Another way to do this is to make an htaccess rule for each url using regular expressions.

    
28.07.2015 / 14:54