Htaccess mod_rewrite help

I’m trying to create some redirects for my site. I would like to make ‘category.php?value=var’ into ‘/var’ and i don’t really know how to do it. It’s my first attempt at trying this type of thing and every attempt haven’t worked. Any help would be appreciated.

what kind of redirects are you planning to do? maybe if it cause you a problem try to use php or javascript redirect?

The most basic example to do that is


Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteRule ^(.*)$ category.php?value=$1 [L,R=301]

This is what I am using and came up with. If there’s anything wrong could someone please let me know. Thank you.

Options +FollowSymLinks -MultiViews

RewriteEngine on
RewriteRule ^upload/$ upload.php
RewriteRule ^([^/\\.]+)/?$ category.php?value=$1 [L]

205,

I’m not sure why Rémon’s now incorporating the Options line (those directives should be done at the server level by your host) but he’s forgotten the :kaioken: EVERYTHING :kaioken: atom’s introduction of infinite (loopy) problems - in other words, (.*) will match everything (as well as nothing), thus it will certainly match category.php.

Since your question was how to redirect var to category.php?value=var, so long as you can specify var in a manner that will NOT match category.php (or other files), you should specify the allowable characters for var, i.e., ([a-z]+) for lowercase characters, etc. Actually, you get around this, too by use of your ([^/\.]+) but you should know that the dot character is NOT supposed to be escaped WITHIN A CHARACTER RANGE DEFINITION.

As has been true for several years (as attested to by this forum’s sticky threads, if nothing else), the mod_rewrite tutorial Article linked in my signature will provide all this and so much more.

Regards,

DK