【发布时间】:2021-10-02 07:43:45
【问题描述】:
我正在尝试重定向我的网址:
www.site.com/dashboard/invest-package.php?packageID=1
到
www.site.com/dashboard/invest-package/1
其实我用-解决了这个问题
<a href="invest-package-'.$row['packageID'].'">Invest</a>
RewriteRule ^invest-package-(.*)$ invest-package.php?packageID=$1 [QSA,L]
但我想用“/”不喜欢用“-”。我在互联网上找到的解决方案不起作用。我不断收到 404 not found 错误。
这是我到invest-package.php 的链接
<a href="invest-package/'.$row['packageID'].'">Invest</a>
和 .htaccess 文件:
Options -Indexes
RewriteEngine On
RewriteBase /dashboard/
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^invest-package/(.*)$ invest-package.php?packageID=$1 [QSA,L]
【问题讨论】:
标签: php apache .htaccess mod-rewrite url-rewriting