url redirect to page in external site [closed]

南楼画角 提交于 2020-01-05 10:09:36

问题


i have a page in my siteA http://www.siteA.com/1987/title.html

i want to 301 redirect above page to a page in external site siteB as shown in example below http://www.siteB.com/page/title3.html

I want to do this in htacess, not in php

I have tried

#redirect 301 /1987/title.html http://www.siteB.com/page/title3.html

this doesnot seem to work for me


回答1:


Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.siteA\.com$ [NC]
RewriteRule ^1987/title\.html$ http://www.siteB.com/page/title3.html [L,R=301,NC]


来源:https://stackoverflow.com/questions/16221344/url-redirect-to-page-in-external-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!