I've tried and tried and tried by my htaccess knowledge isn't great, and I cannot find anything to suit my needs (but then I'm not sure what i'm searching for).
Effectively my question is twofold:
I want to convert: http://subdomain.domain.com/hello
To: http://subdomain.domain.com/index.php?string=helloBut occasionally there could be a querystring as well so...
From: http://subdomain.domain.com/hello?query=true To: http://subdomain.domain.com/index.php?string=hello&query=trueSo far I've managed the first:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d [NC]
RewriteRule .* - [L]
RewriteRule ^([^/\.]+)/?$ client开发者_高级运维.php?user=$1&$2 [L]
Remember, the second is a potential :) Thanks!
You just need to set the QSA flag for the last rule:
RewriteRule ^([^/\.]+)/?$ client.php?user=$1 [L,QSA]
Then the original requested query will automatically appended to the new one.
精彩评论