【发布时间】:2021-02-25 04:25:59
【问题描述】:
我的网址看起来像 -http://localhost/user_notes/public/index.php?id=1234.
我想把它变成用户友好的网址,比如http://localhost/user_notes/public/1234
我的.htaccess 文件看起来像 -
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/([0-9]+)/ /index.php?id=$1
</IfModule>
所以现在当我在浏览器中使用http://localhost/user_notes/public/1234 位置时,它给了我错误(在此服务器上找不到请求的 URL)。所以上面的 htaccess 文件没有像我预期的那样工作。
我的目录结构如下 -
【问题讨论】:
标签: apache .htaccess mod-rewrite url-rewriting friendly-url