.htaccess rewrite to short url handle exceptions -


here htaccess:

rewriteengine on  rewritebase /  rewriterule ^about$ about.php        rewriterule ^contact$ contact.php rewriterule ^user/([^/.]+)?$ user.php?uname=$1&%{query_string} 

what trying when goes mysite.com/username : user.php?uname=$1&%{query_string} : rewriterule ^/([^/.]+)?$ user.php?uname=$1&%{query_string}

but if username page name? example if username about, or contact ? there way add exceptions ? or how go handling that.

the simplest solution create blacklist of usernames. don't allow create username matches required page on site. if put [l] flag on current rules, stop further rules processing, can add rule @ bottom catch usernames.

rewriterule ^([^/.]+)?$ user.php?uname=$1&%{query_string} 

of course if don't blacklist usernames system should work. have use /user/about, /about uri used.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -