所以,我的主机最近宕机了,我不得不转移到一个新的主机-但这意味着我的htaccess文件在移动中丢失了…
现在我必须重写它,但它一开始就是一个垃圾……
我需要做的是编写以下代码...
转向..。
http://longdomain.com/show.php?id=100
转到
http://shortdomain.com/100
因此,当有人访问短URL时,它将加载长URL,而不会更改他们所在的实际URL。
这使我的短URL服务与帐户和URL管理部分分开。
我使用了mod代理,这样我就可以跨域了。
然而,我对自己是如何做到这一点感到困惑。
谢谢你们的帮助。
发布于 2012-01-06 05:16:51
将以下内容添加到shortdomain
站点根目录下的.htaccess中
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]
https://stackoverflow.com/questions/8749647
复制相似问题