开发者

Update: RewriteRule on virtual subdomain

here i am again :(

got big problem hiks ... need HELP !!!

i have URL like

http://www.foo.com/user/index.php?uid=me&page=about

and i want to change into like this

http://me.foo.com/about

i already success to make virtual subdomain + wildcard + using this htaccess

RewriteBase /
RewriteCond %{HTTP_HOST} !www.foo.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).foo.com [NC]
RewriteRule (.*) user/index.php?uid=%2 [L]

but i do not know how to make &page=about appears on request


UPDATE

No body Answer this question :(

update, now i already have a solution, "with my try and error" :P

"but" the htacces looks weird. now, any one can fix this? or maybe what should i do ... this htaccess was RUN corecty

RewriteCond %{HTTP_HOST} !www.foo.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).foo.com [NC]
RewriteRule (.*)^/?([a-zA-Z0-9]+)/([a-zA-Z0-9]+)$ user/index.php?uid=%2&page=$2&subrequest=$3 [L]

RewriteCond %{HTTP_HOST} !www.foo.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).foo.com [NC]
RewriteRule (.*)^/?([a-zA-Z0-9]+)$ user/index.php?uid=%2&page=$2 [L]

RewriteCond %{HTTP_HOST} !www.foo.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).foo.com [NC]
RewriteRule (.*) user/index.php?uid=%2 [L]

I really need your help maste开发者_运维百科rs :(

regard.

Stecy >:(


See it this helps:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www\.)?([a-z0-9-]+)(?<!www)\.foo\.com$ [NC]
RewriteRule ^([a-z0-9-]*)$ user/index.php?uid=%1&page=$1 [L]

I'll be happy to explain what the above rules do if necessary.


Try using the QSA flag.

RewriteBase /
RewriteCond %{HTTP_HOST} !www.foo.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).foo.com [NC]
RewriteRule (.*) user/index.php?uid=%2 [QSA, L]

Check this out too > HTAccess mod rewrite issue using QSA

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜