繁体   English   中英

如何使用.htaccess重定向我的网站

[英]How do I redirect my site using a .htaccess

如何使用.htaccess重定向我的网站?

http://www.domain.com/index.php

至:

http://www.domain.com/index.php?page=search

它不适用于.htaccess

redirect 301 /index.php http://domain.com/index.php?page=search

使用Redirect指令,您无法将/index.php重定向到/index.php?page=search ,因为它将重定向到导致重定向循环错误的同一位置,您需要使用mod-rewrite:

试试:

RewriteEngine on

RewriteCond %{QUERY_STRING} ^$
RewriteRule ^index\.php$ /index.php?page=search [NC,L,R]

如果您是不可见的重定向,请删除R标志。

暂无
暂无

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

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