How to rewrite links to root from sub directory

Hello there. I intend rewriting a url but when I place the htaccess in my subdomain directory, it tries tries to read from that file in the third string of the rewrite rule and rewrites every single request (regardless of if it matches the third string) to the second string. So I intend placing it in the particular directory I intend working on for specificity. However, it seems the rule does not work with absolute linking like I have below

http://site.com/users/controller/profile.php?username=word1_word2

But I want the above rewritten to
http://site.com/word1.word2/

While the htaccess is still lying in this folder
http://site.com/users/controller/

My regex looks like:

RewriteRule http://site.com/([a-zA-Z]+).([a-zA-Z]+)_?([a-zA-Z.]*[0-9]{0,2})\/? profile.php?username=$1_$2$3 [L]

The digits part of the regex is checking whether we have something like word1.word2 followed by two digits.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.