2012-01-05 149 views
0

所以,我的主人最近去了,我不得不搬到一个新的主机 - 但这就意味着我的htaccess文件迷路了中招......重写现代重写

现在我得重写它,但它开始与有风险的...

我需要做的就是写出下列...

转...

http://longdomain.com/show.php?id=100 

http://shortdomain.com/100 

因此,当有人访问短网址时,它会加载长网址,而不会更改它们的实际网址。

这使我的短URL服务与帐户和URL管理部分分开。

我使用的是mod代理,因此我可以跨域。

虽然我不知道该怎么做,但我不知所措。

感谢您的帮助家伙...

+0

作为一个旁注的:_USE版本控制system_! – KingCrunch 2012-01-05 20:57:31

+0

哈哈,是的,这次我吸取了教训。 – 2012-01-05 21:01:38

回答

0

以下内容添加到你的.htaccess中的根目录,您shortdomain网站

RewriteEngine on 
RewriteBase/

#if its on shortdoman 
RewriteCond %{HTTP_HOST} ^shortdomain\.com$ [NC] 
#with a numeric path, proxy to longdomain and stop processing further rules 
RewriteRule ^([0-9]+)$ http://longdomain.com/show.php?id=$1 [P,L]