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,101
  • 2
  • 11
  • 25
  • 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
  • 761,203
  • 64
  • 569
  • 643