quanto
quanto

Reputation: 59

Htaccess rewriterule $1 gives index.php instead of parameter

I'm trying to get the last rewriterule to get the "lang" in php. However, it returns "index.php" when i open the parameter. What's wrong with the following code?

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)/(.*) index.php?lang=$1&url=$2 [NC]
RewriteRule ^([^/]+)/home/([^/]+)/?$ index.php?lang=$1&voorpagina=$2 [NC]

Upvotes: 2

Views: 874

Answers (1)

Oussama Jilal
Oussama Jilal

Reputation: 7739

Try adding the [L] flag like this :

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/home/([^/]+)/?$ index.php?lang=$1&voorpagina=$2 [NC,L]

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

Upvotes: 1

Related Questions