Forum Moderators: phranque
mydomain.com/dir/var1.html?var2=x&var3=y
to
mydomain.com/test.php?var1=var1&var2=var2&var3=var3
i try this rule:
RewriteRule ^dir/(.*)\.html?var2=(.*)&var3=(.*)$ test.php?var1=$1&var2=$2&var3=$3
the problem is with the "?" sign after the .HTML (RewriteRule ^dir/(.*)\.html?)
if i replace the "?" sign with any other sign its work.
the problem is that i have to use the "?" sign.
if you know what the code should look like please help.
thank you.
can you give me another example to clear it up or tell me what should my rewrite rule look like in my case.
thanks for your help, trust me Jim i'm not lazy i really don't know what to do with the information that you gave me.
thanks in advance... :)
You will also find that most hosting companies provide no support for mod_rewrite; They don't want to be responsible for messing up your server.
We welcome specific questions here, but we cannot write your code for you. You are the one who will have to thoroughly test it and maintain it over time; It would be best to learn all you can about it. Otherwise, you might prefer to hire someone to configure your server and look after it.
There are also several very useful links in our Forum Charter to help you get started, including a link to the Apache mod_rewrite documentation. In addition, there are many threads on this subject available by using Site Search, and some tutorials and primers in our Forum Library. All of these resources are available in the links at the top of every forum page on WebmasterWorld.
When reviewing the mod_rewrite documentation, pay particular attention to the %{QUERY_STRING} variable, as tested by the RewriteCond directive.
Jim
i just don't know what to do with the "?" sign.
all i'm asking is to get some examples similar to my problem.
you can give me the line/rule that will solve my problem i will take the responsibility for using it.
i kind of lost , i'm looking for answers for few days now and its really important to me because i'm losing money.
so please, if you know the solution for my problem please tell it to me.
RewriteCond %{QUERY_STRING} ^var2=[^&]+&var3=[^&]+
RewriteRule ^dir/([^.]+)\.html$ test.php?var1=$1 [QSA,L]
If the variable order in the rewritten query string is critical, then use:
RewriteCond %{QUERY_STRING} ^var2=([^&]+)&var3=([^&]+)
RewriteRule ^dir/([^.]+)\.html$ test.php?var1=$1&var2=%1&var3=%2 [L]
Jim
RewriteRule ^dir/([^.]+)\.html$ /test.php?var1=$1 [QSA,L]
RewriteRule ^dir/([^/.]+)\.html$ /test.php?var1=$1 [QSA,L]
Jim