繁体   English   中英

使用htaccess文件重定向链接

[英]redirect links using htaccess file

如何使用.htaccess将链接重定向到特定链接

http://www.example.com/one http://differentdomain.co.uk/a/
http://www.example.com/two http://differentdomain.co.uk/b/
http://www.example.com/three http://differentdomain.co.uk/c/
http://www.example.com/four http://differentdomain.co.uk/d/

我已经尝试了Redirect 301&RewriteRule,但它根本不起作用,即时通讯使用的是Apache服务器

这就是我的.htaccess文件中的内容

<IfModule mod_rewrite.c>
#Options +FollowSymLinks
#Options +Indexes 
RewriteEngine On
#RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^/one http://differentdomain.co.uk/a/ [R=301,L]
</IfModule>

这两个代码对我都不起作用

Redirect 301 /one/ http://differentdomain.co.uk/a/
RewriteRule ^/one http://differentdomain.co.uk/a/ [R=301,L]

顺便说一下,我正在工作的域为空,只有.htaccess和cgi-bin文件夹存在

我认为(不确定) Redirect指令不起作用,因为您的根目录中没有/one路径。

尝试这个 :

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^one http://differentdomain.co.uk/a/ [R=301,L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM