Need help with .htaccess redirection


I have trouble with some links like next one:


Can you help me how can I redirect those kind of links to page like: http://localhost/items/

With “those kind of links”, I mean links like:

Not sure, but looks like the problem is in question mark in url… I tried with

Redirect 301 ^browse(.) /items/
Redirect 301 ^browse(.
)(.*) /items
… but no luck.

Can you help me how can I make redirection to /items/ page please?

Thank you in advance!


The ? is a reserved character which separates a URI from a query string. This makes handling with mod_alias almost impossible and mod_rewrite requires the use of RewriteCond statements to look into variables other than {REQUEST_URI}.

Warning: Beware the inappropriate use of (.*) as that’s the greatest potential for generating loops (albeit it can’t do that - or anything else) in a Redirect statement.

To redirect from browse to items, Redirect 301 browse /items/ should do (and lose all the information contained in the query strings).



you can add this to you .htaccess :

# Redirect old file path to new file path
Redirect http://localhost/items/ http://localhost/browse/?price=DESC&from=87/15/0/


I need to redirect anything from http://localhost/browse?price=whatever_is_here to http://localhost/items/.

Problem is that redirection of only http://localhost/browse is not enough for me in this case.

I don’t know why did not make it with mentioned redirectives, and that’s why I need help here.

@bagitahu, thank you, but I need redirection for another way round, not like you mentioned.

Pls help


Did you bother to read the sticky threads or the tutorial article linked in my signature (there are a large number of sample codes in it, too)? If you can’t find the answer at your fingertips, make an attempt and I’ll correct it with you (the reason for my “no coding for script kiddies” rule is to help all members to learn).



Tnx, I manage to do it. I created new directory called browse, with single index.html file in it, that contains redirection to the /items link (on server, html file is treated as php).

It is not .heaccess solution, but it’s quick and it works.