Search code examples
.htaccessmod-rewriteurl-rewritingfriendly-url

RewriteRule for profile system


I want to redirect website.com/member/gami To website.com/member.php?name=gami

I have tried:

RewriteRule ^(.*)/member$ member.php?name=$1 [NC, QSA]

Solution

  • With your shown rules, please try following htaccess rules. Please make sure to clear your browser cache before testing your URLs.

    RewriteEngine ON
    ##Internal rewrite rules for non-existing uris to php files internally.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{DOCUMENT_ROOT}/$1.php -f
    RewriteRule ^([^/]*)/(.*)/?$ $1.php?name=$2 [QSA,L]