I'm new to mod rewrite but how i should make this work? I use shown code but then in address bar i type domain.com/otherdomain.com it shows 404 error RewriteEngine On RewriteRule /$1 index.php?url=$1 Code (markup):
I'm not sure what you're trying to do - rewrite every page to your index script? The first $1 contains nothing. If you're putting this in the root of your domain, you also shouldn't need the first slash. If your rewriterule contains a regex expression, you can surround bits of the expression with parenthesis and this will capture the match into a backreference of the form $N. For the pattern, its standard regex - in this case you want to match everything. RewriteRule ^(.*)$ index.php?url=$1 [L,QSA] Code (markup): I've also included the Query String Append (QSA) flag - so domain.com/file.php?var=val will get rewritten to index.php?url=file.php&var=val. Hopefully that helps a bit..