gpt4 book ai didi

javascript - .htaccess 重定向不会发生

转载 作者:行者123 更新时间:2023-11-28 06:39:58 24 4
gpt4 key购买 nike

我有一个动态 JavaScript 链接:

https://example.com/~scale/playground/[my dynamic value]

我在 JavaScript 中生成这个值。单击此链接后,它会在我的数据库中查找[我的动态值],并重定向到上述值的网址。

我的 .htaccess 看起来像这样:

RewriteBase /playground/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?id=$1 [L]

但点击链接时显示 404 错误。为什么我的 .htaccess 不工作?

最佳答案

看看这个。我希望你能得到一个想法

# RewriteBase equivalent - Production
RewriteCond %{HTTP_HOST} !^localhost$
RewriteRule . - [E=REWRITEBASE:/]

# RewriteBase equivalent - Development
RewriteCond %{HTTP_HOST} ^xx\.xx\.xx\.xx$
RewriteRule . - [E=REWRITEBASE:/~countryr/]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/-]+)/?$ %{ENV:REWRITEBASE}page.php?pid=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ %{ENV:REWRITEBASE}blog-detail.php?url=$1 [QSA,L]

关于javascript - .htaccess 重定向不会发生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33933601/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com