我是Apache重寫URL的初學者。很難做到mod重寫
我有一個問題,重寫URL。
我想重寫www.test.com/abc/index.php?val=123到www.test.com/abc/123/index.php
注:ABC是文件夾
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/([0-9]+)/index.php $1/index.php?val=$2 [QSA,L]
不好意思,不得不再次進行編輯。希望這次是正確的! – arkascha
我嘗試鍵入test.com/abc/123/index.php,但它是錯誤的。請求的URL/abc/123在此服務器上找不到。 – user1759419
嗯,是的,如果這樣的文件夾不存在,錯誤是有道理的。你在你的問題中寫道,這是你想要重寫請求的最終url:'www.test.com/abc/123/index.php'。這會在文件夾「123」內請求一個文件「index.php」。 – arkascha