I have a URL like http://www.psreducators.com/agent-profile/?u=donald-mark, but I want the users to see the URL as http://www.psreducators.com/agent-profile/donald-mark. (donald-mark is the user profile name.)

How can I achieve this using .htaccess RewriteRule directives?

  • 2
    There is no need to use a get parameter with EE. Is this a channel entry or is it pulling from the member profile itself?
    – Jim Wyse
    Sep 14, 2015 at 11:43

2 Answers 2


One method would be to use an .htaccess RewriteRule to make URI's that look like that:


to be rewritten like this:


For this, you would use a RewriteRule. Here is an example:

RewriteRule ^agent-profile.php\/?u=(.*)$ agent-profile.php/$1/ [L,NC,R=301]

This will capture anything after the u= GET param, and the place it in the $1 of the second param of the rewrite. It will be a permanent redirect (R=301), it will ignore case when matching (remove the NC of the flags if you don't want that), and if this is matched, the .htaccess file will not bother trying any rules after it (L[ast]). This is untested, but should get you going.

  • Could you clarify what these rules do? Also, where they belong (i.e., in the root .htaccess file, after the index.php rewrite, hint hint)?
    – jrothafer
    Sep 22, 2015 at 22:05
  • 1
    Sorry but your answer needed a lot of expansion to not be low quality.
    – jrothafer
    Sep 22, 2015 at 23:03

You can try the following .htaccess rules (tested).

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /agent-profile/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /agent-profile/index.php [L]

Add the following code to your index.php file.

  header("HTTP/1.0 200");

Your Answer

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

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