php - Mod_Rewrite URL -


current url:

http://localhost/blog/profile.php?username=username&page_type=following 

i want be:

http://localhost/blog/profile/username/following 

current .htaccess:

rewriteengine on checkcaseonly on checkspelling on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_filename} !-l rewriterule ^profile/(.*)$ /blog/profile.php?username=$1&page_type=$2 [qsa,l] 

is possible rewrite way? or there better way?

you need 2 capture groups:

rewriterule ^profile/(.*?)/(.*)$ /blog/profile.php?username=$1&page_type=$2 [qsa,l] 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -