Annoying .htaccess RewriteRule issue

jimbobo2779

Elite Member
Jr. VIP
Joined
Sep 17, 2008
Messages
6,037
Reaction score
3,974
Hey guys I have been having this annoying problem today and despite years of handling redirects I am just having a complete blank with this one.

I am wanting to do a redirect so that the page below:
http://domain.com/?someText
to
http://domain.com/someText

and also need it to act as below
http://domain.com/someText?someMoreText
to
http://domain.com/domeTextsomeMoreText

Essentially pulling out the ? character wherever it appears in the url.

I have tried the rule below and many many variations of it but I am just being a big idiot about this.
RewriteRule ^\?(.*)$ $1 [NC,L] #this is for the first variation
RewriteRule ^\(.*)?(.*)$ $1 [NC,L] # for the second variation

Any advice on how this may be achieved would be very appreciated.

Thanks guys.
 
Last edited:
I have tried on a plesk VPS with mod rewrite enabled as well as my local test server. I don't think it is a problem with the setup on the server so much as it is a problem with the .htaccess code.

All my other redirects on other domains on the same servers are working fine.

Thanks for reply, do you have much experience with .htaccess?
 
Back
Top