Converting Standard Request Uri Into Clean URL using .htaccess
I have a URL with the following format:
http://domain.com/checkout/nonce/701fe0f652/order/108/?token=EC-0DS37792JX3680821
I try to convert it into a clean URL using .htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?token=(.*)$ /index.php/$1/token/$2/ [R]
The RewriteRule somehow does not work. I already test that using http://jakarta.apache.org/regexp/applet.html and resulting exact matches.
I'm using CodeIgniter, and already test to put the clean URL (http://domain.com/checkout/nonce/701fe0f652/order/108/token/EC-0DS37792JX3680821) directly with no problem.
Can somebody help me?
Thank you.
Best r开发者_如何学Cegards.
I have found the answer for it
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^token=([a-zA-Z0-9\-]+)
RewriteRule ^([a-z0-9\/\-.]+)$ $1token/%1? [R=301,L]
精彩评论