I have problem with rewrite in .htaccess

I want to this link

http://www.mysite.com/index.php?lang=1

look like this link

http://www.mysite.com/index

And it should be for every .php file to be like that

I have this so far:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^\w+\ /(.*)\.php\ HTTP
RewriteRule ^ http://%{HTTP_HOST}/%1 [R=301]
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule .* $0.php

and it work when is not with ?lang=1

thx in advance...

Recommended Answers

From my experience, I think you should be redirecting all requests to

index.php

instead of $0 which may correspond to

index?lang=1.php

which may not exist.

Jump to Post

All 2 Replies

From my experience, I think you should be redirecting all requests to

index.php

instead of $0 which may correspond to

index?lang=1.php

which may not exist.

I just want to when I look in url bar in browser i see
www.mysite.com/index or
www.mysite.com/contact
www.mysite.com/aboutus
etc.
without extension and ?lang=1

Is that possible?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.