RezaM
RezaM

Reputation: 167

how to let htaccess work on every page

I think there is an easy solutions to my problem, but I'm quite the noob when it comes to htaccess. So I'm asking for help.

RewriteRule ^home/([\w-]+)/?$ home.php?lang=$1 [NC,L,QSA]

This is my current code, and it works. But unfortunately, it only works on the page "home". And I want it to work on all pages of my URL. I've managed narrowing it down to this line:

RewriteRule ^/([\w-]+)/?$ ?lang=$1 [NC,L,QSA]

But it hasn't had any effect. So, could anyone help me with this?

Upvotes: 1

Views: 19

Answers (1)

Amit Verma
Amit Verma

Reputation: 41209

You have to remove the leading slash from rule's pattern

RewriteRule ^([\w-]+)/?$ ?lang=$1 [NC,L,QSA]

Upvotes: 1

Related Questions