[英]simple redirect using .htaccess is not working
我正在嘗試創建一個簡單的重定向,將我對user/55
所有請求都重定向到folder2/index2.html
我正在對運行wamp的localhost進行測試。 我的項目層次結構是:
我這樣定義.htaccess
:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^users/55 folder2/index2.html [R=301,L]
我的主頁是index1.html
,它看起來像這樣:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1>Index1 page</h1>
<a href="users/55">go to second page</a>
</body>
</html>
當我按下鏈接時,沒有重定向,而是出現錯誤: The requested URL /redirect/folder1/users/ was not found on this server.
我在Apache服務器上啟用了mod_rewrite,但在日志中看不到錯誤。 我在做錯什么,我嘗試遵循一個簡單的指南,但它不起作用。
我認為這僅僅是因為錨標記中的網址是相對網址。
<a href="users/55">go to second page</a>
上面將鏈接到/redirect/folder1/users/
如果要鏈接到/redirect/users
,可以嘗試
<a href="/redirect/users/55">go to second page</a>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.