gpt4 book ai didi

How to remove ?id = when href are written like : ?id= on urls?(当href写成:?id=<?php......php>on URL时,如何删除?id=?)

转载 作者:bug小助手 更新时间:2023-10-28 21:51:05 24 4
gpt4 key购买 nike



In fact I don't want ids to be displayed in url bar. I managed to remove .php trough .htacess and it's now showing:
https://example.com/article?id=27
For pages like "example.com/blog.php" to be like "example.com/blog", I have to modify the corresponding in the code like this: instead of <a href="blog.php", here it works fine and it redirects to desired link ( "http://example.com/blog "). But, When it comes to pages like :
article.php?id=, I don’t see how to modify this or what to write in .htacess.

事实上,我不希望ID显示在URL栏中。我设法通过.htacess删除了.php槽,现在它显示:https://example.com/article?id=27对于像“Example.com/Bloom.php”这样的页面像“Example.com/Blog”,我必须修改代码中的相应内容,如下所示:不是


I searched here and there but it seems it's not giving what I want

我到处找,但似乎没有给我想要的


I tried this:

我试过这个:




In .htacess:
RewriteRule ^([^.]+)/?$ bloge.php?id=$1 [L, QSA]






In the code:
href="article?id="
It's showing:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.




how to remove = and ? from URL in php by someone was not answered and it's the same as what I was looking for.

如何删除=and?有人在php中的URL没有得到回应,这与我正在寻找的相同。


更多回答

How exactly do you expect to be able to link to the appropriate article without the ability to specify some sort of unique identifier?

在不能指定某种唯一标识符的情况下,您如何准确地期望能够链接到适当的文章?

I get your point. Should I change the title of the article in the database to be the unique identifier instead of the ID?

我了解你的意思。我应该将数据库中文章的标题更改为唯一标识符而不是ID吗?

优秀答案推荐

if the page article.php is expecting the id to be passed via GET you can't without changing also the application.

如果页面文章.php希望通过GET传递id,那么您必须同时更改应用程序。


if you can change the application you can "hide" the param passing it via POST. Mind the quotation marks as you can't actually hide the param, using POST method it won't be visible on the URL but it's always visible (and exploitable if that's your concern) in the HTTP request.

如果您可以更改应用程序,则可以“隐藏”通过POST传递它的参数。注意引号,因为您不能实际隐藏参数,使用POST方法它将在URL上不可见,但在HTTP请求中始终可见(如果您担心的话还可以利用)。


if you can't change the application and you have programming skills you could write a front-end wrapper around it in JS or even a server side language as php that translates the web page in whatever format you choose to display it and back, but "could" and "should" don't always meet, knowing why you want this could help finding a solution to your problem.

如果你不能改变应用程序,并且你有编程技能,你可以用JS编写一个前端包装器,或者甚至用php这样的服务器端语言来翻译网页,无论你选择哪种格式来显示它,但并不总是相遇,知道你为什么想要这样做可以帮助你找到解决问题的方法。


更多回答

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