This is piece of mine .htaccess file: RewriteCond %{HTTP_HOST} !^www\.example.com RewriteCond %{HTTP_HOST} ([^.]+)\.example.com RewriteRule ^(.*)$ index.php?pg=%1&page=$1 Code (markup): Above will redirects www.sub.example.com into index.php?pg=sub&page= Problem is that I want to make secound variable subsidiary by this what I give behind domain name. Ex. sub.example.com/info ---> index.php?pg=sub&page=info Code (markup): This what I gave should do the trick. I tested it here: http://htaccess.madewithlove.be/ and it works. But when I add it on server the secound variable is always "index.php". Ex. sub.example.com/info ---> index.php?pg=sub&page=index.php Code (markup): What is the problem? How can I solve it? Please help!
Do you have any other redirects earlier? Can you try, from command line: wget -O /dev/null sub.example.com/info This will show you all redirects on the way. I bet $1 that sub.example.com/info redirects you to sub.example.com/index.php first.
Yes I have some code before it, but nothing special: AddDefaultCharset utf-8 Options FollowSymLinks RewriteEngine On RewriteBase / Code (markup): I used this command that You gave me. Result and whole .htaccess file is on Your PM. I hope that you can help me
I guess that the following .htaccess generators will help you: http://www.generateit.net/mod-rewrite http://turnkey-buddy.com/mod_rewrite_tool
Nvm problem is solved. I used this: RewriteCond %{HTTP_HOST} !^www\.example.com RewriteCond %{HTTP_HOST} ([^.]+)\.example.com RewriteCond %{DOCUMENT_ROOT}/%2 -d RewriteRule ^(.*)$ index.php?pg=%1&page=$1 [L,QSA]