开发者

how can i prevent the get url to show text or random text instead

开发者 https://www.devze.com 2023-02-04 08:51 出处:网络
eg, $search = $_GET[$id]; instead of showing website.com/result.php?find=56 it would be website.com/result.php?find=sometext

eg, $search = $_GET[$id];

instead of showing website.com/result.php?find=56

it would be website.com/result.php?find=sometext

in the db 56 is the id and sometext is the title how can i get the title to show instead when i use the get url id开发者_运维技巧 function


you can also use .htaccess redirection with something like:

RewriteEngine On
RewriteRule ^find/(.*)$ result.php?find=$1 [L,QSA]

so, you can use URLs like:

www.company.com/find/some-text

going directly to:

www.company.com/result.php?find=some-text

niceUrls are better for SEO :)


Add another unique field to the database that will hold the slug that you will use for the page, and use that instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消