I got a htaccess in my Root directory.
My files path http://example.com/folder1/folder2/index.php?country=eu&lang=en
I made this in htaccess.
RewriteCond %{HTTP_HOST} ^(www.)?anothersite.com$
RewriteRule ^([^/]*)/([^/]*)$ /folder1/folder2/index.php?country=$1&lang=$2 [L]
RewriteRule ^([^/]*)$ /folder1/folder2/index.php [L]
And looks like this
But i want like this -> http://example.com/eu-en
Is there a way to do this in htaccess?
EDIT:
I have to use rewrite cond, because im redirecting to folders depends of host.
EDIT 2: SOLUTION
RewriteCond %{HTTP_HOST} ^(www.)?anothersite.com$
RewriteRule ^([a-z]{2,2})-([a-zA-Z0-9_-]+)$ /folder1/folder2/index.php?country=$1&lang=$2 [QSA]
Thanks to answers, it is working now. But after that i got the css and js errors on website. Then i changed css and js paths /folder1/folder2/css.
2
Answers
You need to append with the [QSA] (query string append) tag. Try
See http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
Try with below,