1

The multiple RewriteRule's doesn't work into my .htaccess file.

To get direct into the point, i have this lines of code into my .htaccess file

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ ./index.php?lang=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/$ ./profile.php?page=$1 [L]

The problem is when i add a parameter into my domain, let's suppose www.eaxmple.com/something, i land always to home page. What i want to do is when i set a parameter with slash at the end to go to profile.php and without slash to move into index.php. Even if i tried to put a parameter i always move to index page.

Can someone help me?

Vasileios Tsakalis
  • 1,001
  • 2
  • 11
  • 23
  • see here [http://stackoverflow.com/questions/16003269/removing-php-extension-from-urls-using-htaccess][1] – D Coder May 06 '16 at 11:07

1 Answers1

2

.* will match everything including trailing /.

Try rules in this order:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L][

RewriteRule ^(.+)/$ profile.php?page=$1 [L,QSA]

RewriteRule ^(.*)$ index.php?lang=$1 [L,QSA]
anubhava
  • 713,503
  • 59
  • 514
  • 593