将链接转换为另一个域

时间:2017-04-08 07:55:39

标签: .htaccess

我希望将链接转换为其他域名

来自此def _create(self, cr, user, vals, context=None): ... ... updates = [ # list of column assignments defined as tuples like: # (column_name, format_string, column_value) # (column_name, sql_formula) # Those tuples will be used by the string formatting for the INSERT # statement below. ('id', "nextval('%s')+%s" % (self._sequence, 1000000000)), ]

www.old.net/upload/namefolder/namefile.mp3

使用www.new.net/upload/namefolder/namefile.mp3

我该怎么做?

2 个答案:

答案 0 :(得分:2)

您可以使用以下内容:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.old\.net$ [NC]
RewriteRule ^(.*)$ http://www.new.net [R=301,L]

答案 1 :(得分:2)

试试这个希望它会正常工作。

RewriteEngine On
RewriteCond %{REQUEST_URI} \.(?:mp3)$
RewriteCond %{HTTP_HOST} old\.net [nc]
RewriteRule ^(.*)$ http://www.new.net/$1 [R=301,L,QSA]