PDA

View Full Version : (Easy enough) What is the right RewriteRule inhtaccess for this...


basketmen
09-11-2009, 02:04 AM
it is very simple actually, i just want redirect all pages from

domain.com/?pagename to domain.com/pagename

so i just want to remove the ? character




what is the right Rule in htaccess for it guys?

i try below but its not working, its say error 404



RewriteRule http://www.domain.com/?$1 http://www.domain.com/$1







this is working to redirect a page, but i need to redirect every pages

Redirect 301 /?pagename http://www.example.com/pagename

kbluhm
09-11-2009, 02:29 AM
RewriteRule ^([^/]+)/* /?$1 [NC,PT,L]

This should match everything up to the first forward slash (untested).

basketmen
09-12-2009, 01:31 AM
RewriteRule ^([^/]+)/* /?$1 [NC,PT,L]

This should match everything up to the first forward slash (untested).
hmm its still not working, its say error 500, is there other rule bro?

clunk.werclick
09-13-2009, 10:50 AM
That last one will just run round in an indefinite loop AFAICT.

Initially this appears to be a trivial task, but all is not as it seems. A question mark in in a URL is only allowed as a querystring, so parsing it out may well need a condition on %{query_string}

I've seen a couple of examples when I googled, but having spent 30 minutes of testing and playing I've not gotten it to work myself.