2010-08-25 139 views
0

好吧,我想做的事就是......阿帕奇/ htaccess的URL重写帮助

http://domain.com/hdu79ejo 

上面应该被重定向到

http://domain.com/client/?share=hdu79ejo 

其中hdu79ejo可以是任意值。

但是......

http://domain.com/client 

http://domain.com 

不应该在所有的重定向。

这里是我的代码

RewriteEngine on 
RewriteCond $1 !^(client) 
RewriteRule ^(.*)$ /client/?share=$1 [L] 

它工作得很好,除了http://domain.com也越来越重定向到http://domain.com/client/?share=

感谢您的帮助..

回答

1

你将不得不再添RewriteCond。像这样的东西应该工作(未经测试):

RewriteEngine on 
RewriteCond %{REQUEST_URI} !^/?$ 
RewriteCond %{REQUEST_URI} !^/client/?$ 
RewriteRule ^(.*)$ /client/?share=$1 [L] 
0

你可以修改重写COND到:

+0

啊,当我改变了它显示404 http://domain.com/5iWxD0GZVVk所以这意味着它不会重定向它。 – Arshdeep 2010-08-25 13:20:32