Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite

         

jp_css

5:38 pm on May 15, 2004 (gmt 0)

10+ Year Member



I just can't get this thing down. What about if I want to convert something like ../index.php?path=directory/sub_directory/... into ../directory/sub_directory/...? Is this possbile?

gergoe

7:12 pm on May 15, 2004 (gmt 0)

10+ Year Member



certainly;

RewriteEngine on
RewriteCond %{REQUEST_URI} /index.php$
RewriteCond %{QUERY_STRING} \?path=
RewriteRule \?path=([^&]*)$ $1

this should do the trick, but there are some things you have to keep in mind; this works only you you have the url in the form as you mentioned. you have to find out for yourself the right directory, where these directives will be working properly, otherwise you might get a lot of 404 errors. if you put it in a htaccess file not in the root of your site, then you have to use the RewriteBase directive to define the (virtual) directory where the htaccess file is.
in general i highly recommend you to read the manual, so you can understand what these lines are for, and you can adjust it to fit your needs.