0

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]
3

1 Answer 1

1
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.

Sign up to request clarification or add additional context in comments.

6 Comments

Hi, thanks for your help, and explaining. I applied the rule but the url still doesn't change? I have Options +FollowSymlinks and RewriteEngine on set so I don't know why it's not working?
No problem - do you have AllowOverrides All also set? Try inserting some random characters in your .htaccess file to see if it throws a 500 error.
Yes I have that set in my httpd, and random characters throws a 500 error on the site too.
I'm so sorry - I didn't notice the site part of the URL. I updated my answer, can you check now?
Make it RewriteRule ^(site)/(edit)/?$ $1/index.php?option=com_cust&tool=$2 [L,NC,QSA]
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.