簡體   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