我一直在嘗試配置我的 .htaccess 文件以獲得以下結果:當使用正斜杠“/”傳遞參數(在本例中為電子郵件)時,我的 index.php 文件將獲取此參數。但我認為有問題。調用方法的正確方法:http ://localhost.com/method/[email protected]沒有.htaccess的方式: http://localhost.com/method/index.php? [email protected]但即使我配置了.htaccess:<ifmodule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^.]+)/?$ index.php?email=$1 [QSA,L] </ifmodule>出現以下錯誤:未找到 在此服務器上未找到請求的 URL localhost/method/[email protected]。此外,在嘗試使用 ErrorDocument 處理請求時遇到 404 Not Found 錯誤。我在 .htaccess 文件中遺漏了什么嗎?提前致謝。
1 回答

不負相思意
TA貢獻1777條經驗 獲得超10個贊
您的規則規定任何匹配都不得包含.
.
RewriteRule ^([^.]+)/?$ index.php?email=$1 [QSA,L]
然而,顯然一個電子郵件地址包含.
.
嘗試:
RewriteRule ^([^/]+)/?$ index.php?email=$1 [QSA,L]
- 1 回答
- 0 關注
- 117 瀏覽
添加回答
舉報
0/150
提交
取消