A Smith
A Smith

Reputation: 237

.htaccess replace url?

I have a url like this:

localhost/site/index.php?option=com_cust&tool=edit

and I would like to replace index.php?option=com_cust&tool=edit to edit. Is this possible? The attempts I have made do not work, e.g. :

RewriteEngine On
RewriteRule ^index.php?option=com_cust&tool=edit localhost/site/edit [L,QSA,R=301]

Upvotes: 0

Views: 1452

Answers (1)

Ansari
Ansari

Reputation: 8218

RewriteRule ^site/edit site/index.php?option=com_cust&tool=edit [L]

You had it backwards - what the rewrite module does is it takes in what the user typed in (in this case, 'edit') and it transforms it into something your server can understand (loading index.php and passing a bunch of variables to it).

Also, you definitely don't want an external redirect, much less a 301 redirect. 'L' should be the only flag you need here.

Upvotes: 1

Related Questions