I'm having trouble getting a regex to work correctly in my htaccess, I need to take the following url:
http://example.com/p/anything.aspx?id=1
And redirect it to:
http://example.com/-/anything/1
I can get it to redirect to the following just fine, but cant get it to drop the ?id=
http://example.com/-/anything/?id=1
I've tested a few regex's out on regexr.com, and they work fine there, but when I got to actually put it into my .htaccess it doesnt work. Any help you can give would be amazing! I'm probably missing something small and stupid, just not that great with regex's in the htaccess.
.htaccess
RewriteEngine On
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
RewriteRule ^p/([^\.]+)[\?&](\w+)=(\w+) /-/example/$3 [L,R=301]