Hi, i have a problem about RewriteRule, when i was add value to url, i can not get that value with php. For Example; My dynamic url is : domain.com/?a=x&b=y&c=x , I can set : domain.com/x/y/z.html But when a add to url ?d=w i can not get that value, For Example; if url like domain.com/x/y/z.html?d=w i can not get d's value. What is the problem ?
For a start that wouldn't do what you wanted as you're not using $1 ... But try this: RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html\?([^/]*)$ product.php?name=$2&id=$3$4 [L]
I was use that but didn't ok, $1 is unnecessary variable so i don't use that, when i use that code ( your code ), i see page not found. For example; Url is : httq://localhost/content/1258/xxx-yyy-zzzz.html?page=2 Error: The requested URL /content.html/1258/xxx-yyy-zzzz.html was not found on this server. So, system automatic add ".html" to first variable. ( for example blabla.com/content/blabla/blabla.html )
Because when i use direct content in htaccess, it was always add ".html" after /content For example; Url is : httq://localhost/content/1258/xxx-yyy-zzzz.html Htaccess : RewriteRule ^content/([^/]*)/([^/]*)\.html$ product.php?id=$1&name=$2 [L] Error: The requested URL /content.html/1258/xxx-yyy-zzzz.html was not found on this server. But if i a use ([^/]*) it's ok. For example; Url is : httq://localhost/content/1258/xxx-yyy-zzzz.html Htaccess : RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ product.php?id=$1&name=$2 [L] Error: No error, it's ok. Not: I'm using appservnetwork at windows xp.
let's try some RegExp ... : RewriteRule ^content\/([a-zA-Z0-9\-\_]+)\/([a-zA-Z0-9\-\_]+)\.html\?([a-zA-Z0-9\-\_]+)$ product.php?id=$2&name=$3$4 If your server supports RegExp - then that' what it will be I think ... Failing that - I'll test it on my server & perfect it.
Have you not got a live server that you can test on? It's best to test htaccess rewrites online - testing locally can sometimes cause problems.
I have got a live server, but i'm working localhost always, and i usually test script's action, i will change my local server