How would I rewrite the following using mod_rewrite with wildcards:

http://www.serverurl.com/glossary/WordFind.php?wordInput=(Dynamic Wildcard Word Here)


http://www.serverurl.com/index.php?option=com_glossary&Itemid=326&view=word&word=(Dynamic Wildcard Word Here)

Tested and got this to work.

RewriteEngine On
RewriteCond %{QUERY_STRING} ^wordInput=(.*)$
RewriteRule ^/glossary/WordFind\.php.*$ /index.php?option=com_glossary&Itemid=326&view=word&word=%1 [R]
  • My original RewriteCond was against the URI instead of the Query String. I tested this out and it seems to work. – Sean C. Mar 28 '11 at 19:37
  • I got this to kind of work: – Joshua Riddle Mar 28 '11 at 22:20
  • i eventualy got this to kind of work RewriteCond %{QUERY_STRING} ^wordInput=(.*) RewriteRule ^glossary/wordfind\.php index.php?option=com_glossary&Itemid=326&view=word&word=%1 However the url it produces stil contains the wordfind.php. keep in mind the fact that all urls are rewritten to lowercase. Thanks for the help so far. @Sean, youve got me closer to the solution. – Joshua Riddle Mar 28 '11 at 22:22
  • isnt there a special character for removing the original query string? – Joshua Riddle Mar 28 '11 at 22:23
  • I think you need the / in front of index.php to specify the proper URL. index.php is on the root, is it not? RewriteRule ^glossary/wordfind\.php /index.php?option=com_glossary&Itemid=326&view=word&word=%1 – Sean C. Mar 28 '11 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.